سؤال

I am having some trouble getting OpenCover to work

I have the following folder structure

  • \Tools
  • \Tools\Nunit
  • \Tools\OpenCover
  • \Buildartifacts

When my code compiles, all the compiled code is generated into the BuildArtifacts folder. This includes the dll's and corresponding .pdb files

I am struggling to get OpenCover to run

From powershell I am entering the following command from the root folder:

.\tools\OpenCover\OpenCover.Console.exe -register:user -target:.\tools\nunit\nunit-console.exe -targetargs:".\buildartifacts\MVCControllerTests.dll /noshadow" -filter:+[*]* -output:.\coverage.xml

However I keep getting the message: Committing...

No results - no assemblies that matched the supplied filter were instrumented this could be due to missing PDBs for the assemblies that match the filter please review the output file and refer to the Usage guide (Usage.rtf)

I have looked at OpenCover/NUnit can't find PDB files, and I have the /noshadow switch present in my targetargs

I attempted to move /noshadow to be the first in the targetargs, but then I get errors from nunit

I have also updated nunit-console.exe.config and added the following line to the startup node to ensure that all the tests are executed within .net4 instead of .net3.5

<supportedRuntime version="v4.0.30319">

But that made no difference.

When I viewed coverage.xml file, even though I had the noshadow flag, it still appears that nunit is doing a shadowcopy

eg, this was present:

C:\Users\darren\AppData\Local\Temp\nunit20\ShadowCopyCache\10344_634940293912865718\Tests_275832668\assembly\dl3\db34ecee\a0f236ee_a7f4cd01\TABusinessInterface.DLL

Appreciate any help.

هل كانت مفيدة؟

المحلول

The OpenCover WIKI notes that when using PowerShell you should wrap the whole argument in quotes i.e.

-targetargs:".\buildartifacts\MVCControllerTests.dll /noshadow"

becomes

"-targetargs:.\buildartifacts\MVCControllerTests.dll /noshadow"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top