I am using OpenCover to determine code coverage for a simple C# project.
Although I can see MSTest running the unit tests (and succeeding) the generated report is empty.
This is the command I am using:
opencover.console.exe -register -arch:32
-target:"%VSINSTALLDIR%\Common7\IDE\mstest.exe"
-targetargs:"/testcontainer:calculatortest.dll"
-filter:+[calculator.dll]* -output:coverage.xml
Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading calculatortest.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed CalculatorTest.StatisticsTest.AddOccurrenceTest
Passed CalculatorTest.StatisticsTest.AvgTest
2/2 test(s) Passed
Summary
-------
Test Run Completed.
Passed 2
---------
Total 2
Results file: e:\Users\erno\Documents\Visual Studio 2010\Projects\CodeStatistics\CalculatorTest\bin\Debug\TestResults\erno_ERNO01 2011-07-01 14_27_06.trx
Test Settings: Default Test Settings
Visited Classes 0 of 0 (NaN)
Visited Methods 0 of 0 (NaN)
Visited Points 0 of 0 (NaN)
The content of the generated report:
<?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">
<VisitPoints />
</CoverageSession>
The code is running on Windows 7 64-bits but is executed in a 32-bit Visual Studio command prompt environment.
EDIT I am running the command in the directory with the debug build of the unit tests and I added the OpenCover directory to the environment path.
I searched for similar problems with PartCover (because OpenCover appears to be a sort of branch) but could not find anything that matched the problem and presented a solution.
EDIT I also tested with a broader filter -filter:+[*]*
but this did not change the output in any way.
EDIT I also tested with the MSTest /noisolation
argument as mentioned here. Still no results.
EDIT I also tested by removing the filter completely and falling back to the default filter. No results.
You should be able to use the -register:user switch to do per user registration i.e. it registers (and unregisters) without needing full admin rights.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With