I'm trying to use OpenCover to produce some code coverage reports for my solution. I've got it running with assistance from this blog post http://www.allenconway.net/2015/06/using-opencover-and-reportgenerator-to.html, but it's currently not identifying and loading the modules which I want to report on.
Here is what I'm executing:
"%~dp0..\packages\OpenCover.4.7.922\tools\OpenCover.Console.exe" ^
-register:user ^
-target:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\mstest.exe" ^
-targetargs:"/testcontainer:\"%~dp0..\My.Project_Tests\bin\Debug\My.Project_Tests.dll\" /resultsfile:\"%~dp0My.Project.trx\"" ^
-filter:"+[My.Project*]* -[My.Project_Tests]*" ^
-mergebyhash ^
-skipautoprops ^
-output:"%~dp0\GeneratedReports\WebsiteReport.xml"
The output I get:
No tests to execute.
Committing...
No results, this could be for a number of reasons. The most common reasons are:
1) missing PDBs for the assemblies that match the filter please review the
output file and refer to the Usage guide (Usage.rtf) about filters.
2) the profiler may not be registered correctly, please refer to the Usage
guide and the -register switch.
I've tried changing the filter to include everything:
-filter:"+[*]*"
This finds and reports on code coverage within the test project, but doesn't manage to identify or report on coverage in any of the referenced projects which I actually want to test (My.Project).
The projects are all being built and .pdb files are present in the bin folder of the test project.
I would like code coverage reports from all projects referenced by my test project. Does anyone have any idea what's going wrong?
Turns out that I'm an idiot and was running MSTest when I should have been running NUnit console since our tests are all using NUnit.
Posting this just in case it helps someone else out.