0
votes

I'm running OpenCover with the following command line (wrapped for clarity) from an Admin Console.

packages\OpenCover.1.0.625\OpenCover.Console.exe -register:user -target:packages\NUnit.2.5.10.11092\tools\nunit-console.exe -targetargs:"FooProject.nunit" -filter:+[] -output:coverage.xml

I get the output below but the specified coverage.xml file is not create.

Why isn't the output file created?

update
I have registered both the 32 and 64 bit profilers as suggested in the answers to this question and removed the -register flag, but I still get the same output

NUnit version 2.5.10.11092
Copyright (C) 2002-2009 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 2.0.50727.5446 ( Net 2.0 )

ProcessModel: Default DomainUsage: Default
Execution Runtime: Default
..................F....F.F.............F............F..F..F......
Tests run: 58, Errors: 0, Failures: 7, Inconclusive: 0, Time: 1.5298027 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Errors and Failures:
1) Test Failure : FooProject.Tests.Controllers.BarControllerTests.Index
at FooProject.Tests.Controllers.BarControllerTests.Index() in C:\FooProject\FooProject.Tests\Controllers\BarControllerTests.cs:line 27

2) Test Failure : FooProject.Tests.Controllers.FringControllerTests.Index
at FooProject.Tests.Controllers.FringControllerTests.Index() in C:\FooProject\FooProject.Tests\Controllers\FringControllerTests.cs:line 107

3) Test Failure : FooProject.Tests.Controllers.FringControllerTests.Save
at FooProject.Tests.Controllers.FringControllerTests.Save() in C:\FooProject\FooProject.Tests\Controllers\FringControllerTests.cs:line 135

4) Test Failure : FooProject.Tests.Repositories.FringRepositoryTests.Foo
at FooProject.Tests.Repositories.FringRepositoryTests.Foo() in C:\FooProject\FooProject.Tests\Repositories\FringRepositoryTests.cs:line 17

5) Test Failure : FooProject.Tests.Services.BarServiceTests.Frob
at FooProject.Tests.Services.BarServiceTests.Frob() in C:\FooProject\FooProject.Tests\Services\BarServiceTests.cs:line 52

6) Test Failure : FooProject.Tests.Services.FringServiceTests.Frob
at FooProject.Tests.Services.FringServiceTests.Frob() in C:\FooProject\FooProject.Tests\Services\FringServiceTests.cs:line 39

7) Test Failure : FooProject.Tests.Services.FringServiceTests.Frob at FooProject.Tests.Services.FringServiceTests.Frob() in C:\FooProject\FooProject.Tests\Services\FringServiceTests.cs:line 139

Committing....

1

1 Answers

2
votes

It is probably because the profiler hasn't instrumented any assemblies due to missing PDBs.

OpenCover only profiles assemblies for which the PDBs exist.

Nunit copies the assemblies but not the PDBs to an alternate location before testing. Try using the /noshadow option.

NOTE: you may also wish to avoid the +[*]* option as this will mean that you may get instrumentation of all assemblies that you have PDBs i.e. Test assemblies as well as target assemblies and other 3rd party assemblies - this will cause the testing to be slow.


28 Aug 2011 - I have just tested this with the opencover tests and an .nunit file will do shadow copy and so no PDB files found - however if I -targetargs:"OpenCover.Test.nunit /noshadow" then the tests run as expected.

Also make sure the default configuration in the .nunit file has all your tests in it.