Search code examples
.netunit-testingnunitcode-coverageopencover

NUnit tests failing within OpenCover


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!


Solution

  • 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.