After getting OpenCover to work on my machine, the next step is getting it to work with the build server.
I've been trying to integrate OpenCover with MSBuild on a Bamboo Build Server. I have modified Build.proj as follows to run OpenCover after building the solution:
<Target Name="TestAndCodeCoverage" DependsOnTargets="Build" >
<Message Text="Executing Unit Tests and running OpenCover to check code coverage..." />
<MakeDir Directories="Coverage" />
<Exec Command='"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" -targetargs:/testcontainer:"TestProject\bin\Release\TestProject.dll" -filter:+[*]* -output:Coverage\CodeCoverageResults.xml -register:user -mergebyhash' />
</Target>
The "Coverage" directory is created in the solution root directory (which is the working directory during the build). The tests are run and all pass, but after Committing....
is displayed in the Build log (what would be displayed in the command line), no results are generated and the Build moves on to the next task (creating a report with ReportGenerator - this fails as CodeCoverageResults.xml was not created).
When running the same command in the command line on the build machine everything works as expected, and a report can be generated by ReportGenerator.
Has anyone else had the same problem? Do I need to register equivalent dlls like in this PartCover example?