質問

My tests work just fine when executed directly with NUnit, but when executed through OpenCover (still with NUnit as the test runner), I get following errors:

ProcessModel: Default    DomainUsage: Single
Execution Runtime: Default

.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F
.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F. F.F.F.F.F.F.F.F.F.F.F.F.F.F.F
.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F
.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F.F
Tests run: 200, Errors: 0, Failures: 200, Inconclusive: 0, Time: 0,5410309 seconds
   Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Errors and Failures:
1) SetUp Error : GeoGen.Studio.PlugInLoader.LoaderTests
   SetUp : System.MissingMethodException : Method not found: 'VoidSystem.CannotUnloadAppDomainException.SafeVisited(Int32)'.
       at GeoGen.Studio.PlugInLoader.LoaderTests..ctor()

2) Parent Failure : GeoGen.Studio.PlugInLoader.LoaderTests.AddPlugIn_ValidPlugIn_CreatesInstance
   TestFixtureSetUp failed in LoaderTests

The error 2 is repeated for every test. All the tests are supposed to pass (and they pass in NUnit). Coverage was working correctly with NCover, but its trial expired and I can't afford the license.

Thanks for your help!

役に立ちましたか?

解決

I was having the same problem - it seems you posted an issue to github that helped me solve it, so I'm posting it here for anyone else who has the same problem:

I solved the problem by upgrading to the latest OpenCover (at this time, 4.0.804) and adding the -oldStyle switch when I called OpenCover. It also seems the latest OpenCover was outputting something that ReportGenerator didn't like so I had to upgrade that too.

I have no idea what caused this failure, it seemed to come from nowhere on our CI server. Hope that helps anyone stumbling upon this issue in future.

他のヒント

I can't tell if you are using NUnit as the test runner or not for OpenCover. Below is the batch file I use to run OpenCover with NUnit as the test runner. I use ReportGenerator to get a nice web page with all the coverage stats. You may find this useful since you said your tests run fine with the NUnit runner:

set buildOutputFolder=.\build-output
set testDllFolder=\projects\YourProject.Test\bin\Debug
set testDllName=YourProject.Test
set targetDllFilters=+[YourProject*]* -[YourProject.Test*]*

del %buildOutputFolder%\*.*
REM I use a symbolic link to point to a single folder for these tools.
REM Create the link by:
REM mklink /D OClib c:\packages\OpenCover.1.0.719
REM mklink /D RptGen c:\packages\ReportGenerator.1.2.1.0
REM mklink /D NUnitLib c:\packages\NUnit-2.5.10.11092\bin\net-2.0

OClib\OpenCover\OpenCover.Console.exe -register:user -target:"NUnitLib\nunit-console.exe" -targetargs:"/noshadow %testDllFolder%\%testDllName%.dll" -filter:"%targetDllFilters%" -output:"%buildOutputFolder%\CoverageResult.xml"
del TestResult.xml

RptGen\ReportGenerator\ReportGenerator %buildOutputFolder%\CoverageResult.xml %buildOutputFolder%
%buildOutputFolder%\index.htm
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top