OpenCover / NUnit cannot find PDB files

I use OpenCover http://nuget.org/packages/opencover and wrote the following batch file to run unit tests and generate code coverage statistics:

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 an error 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) 

Pretty sure I did something stupid / missed something obvious, but not sure what!

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

Appreciate any help

Thanks,

+6
source share
3 answers

Found a solution, I did not have the / noshadow switch for nunit. That is, the target arguments should be:

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

Now it works fine.

+8
source

Register opencover DLL (use x86 or x64 DLL):

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

For openCover arguments use -register -register:user if it doesn't work -register:path32 .

0
source

I know you are a problem, but I ran into a similar problem. I have already done the thing / noshadow.

In Visual Studio 2015, be sure to update the latest version of OpenCover as described here. - OpenCover / NUnit cannot find PDB files

I would save me an hour of headaches.

0
source

Source: https://habr.com/ru/post/926221/


All Articles