Search code examples
code-coveragemstestopencover

OpenCover Output xml file has 0% code coverage


I am trying to check code coverage of my tests using OpenCover but the generated output xml has 0% code coverage and modules block is empty.

I am using following commandline argument to check codecoverage

opencover.console -target:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" -targetargs:"/testcontainer:"C:\dev\tfs\Main\GUI\Test\Gui.Client.Tests\bin\Debug\Gui.Client.Tests.dll" /testsettings:"C:\dev\tfs\Main\GUI\Local.testsettings"" -targetdir:"C:\dev\tfs\Main\GUI\Test\Gui.Client.Tests\bin\Debug" -filter:+[*]* -output:c:\Reports\MSTest\GuiClientTests.xml

Here is content of output xml file

<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Summary numSequencePoints="0" visitedSequencePoints="0" numBranchPoints="0" visitedBranchPoints="0" sequenceCoverage="0" branchCoverage="0" maxCyclomaticComplexity="0" minCyclomaticComplexity="0" />
<Modules />
</CoverageSession>

Any suggestions?


Solution

  • Perhaps the profiler hasn't been registered

    Try adding -register:user or -register