質問

I'm using OpenCover http://nuget.org/packages/opencover and have written the following batch file to run the unit tests and generate code coverage stats:

echo off

echo ***************************
echo *** Running NUnit tests ***
echo ***************************
"..\packages\OpenCover.4.0.804\OpenCover.Console.exe" -register:user -target:"..\NUnit 2.6\bin\nunit-console-x86.exe" -targetargs:"..\Web.UnitTests\bin\Debug\Web.UnitTests.dll"  -output:coverage.xml

echo **************************************
echo *** Generating coverage statistics ***
echo **************************************
"..\packages\ReportGenerator.1.6.0.0\ReportGenerator.exe" "-reports:coverage.xml" "-targetdir:%CD%"

echo ***********************************
echo *** Launching Internet Explorer ***
echo ***********************************
start "C:\Program Files (x86)\Internet Explorer\iexplore.exe" "%CD%\Index.htm"

pause

However when I run the batch file I get the error:

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)

Pretty sure I've done something silly / missing something obvious, but not sure what!

The PDB files are in the folder: "..\Web.UnitTests\bin\Debug\"

Appreciate any help,

Thanks,

役に立ちましたか?

解決

Found a solution, I was missing the /noshadow switch for nunit. I.e. the target args should be:

-targetargs:"..\Web.UnitTests\bin\Debug\Web.UnitTests.dll /noshadow"

Works perfectly now.

他のヒント

Register the opencover DLL (use the x86 or x64 DLL):

regsvr32 /n /i:user C:OpenCover.4.5.3723\x86\OpenCover.Profiler.dll

In the openCover args, use -register:user if it does not work use -register:path32.

I know you're issue is solved but I was experiencing similar issue to you. I had already done the /noshadow thing.

With Visual studio 2015, make sure to update to the latest version of OpenCover as explained here. - OpenCover/NUnit can't find PDB files

Would have saved me an hour of headaches.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top