NCover Documentation

Please visit Getting Started with Basic Coverage for updated information.

Running NCover on your NUnit tests is as easy as running it with any other console application.

Running NCover Console On Your NUnit Tests

To run NCover Console On Your NUnit Tests, pass the same NUnit command line that you would typically use to run your tests to NCover.Console. A typical command line would look something like:

NCover.Console.exe //x Coverage.xml nunit-console.exe Assembly1.Test.dll Assembly2.Test.dll

The command line above will run the NUnit tests in Assembly1.Test.dll and Assembly2.Test.dll, collect coverage data for their execution, and output the data to an XML file named Coverage.xml.

Running NCover Explorer On Your NUnit Tests

To gather information about the quality of an NUnit test suite in NCover Explorer we'll use the nunit-console.exe application as our executable and provide the proper command line arguments to direct it at our tests.

To Configure Your NCover Explorer Project to run NUnit Tests:

  1. Choose Project Actions, New Project from the toolbar. This will start a new, blank NCover Explorer project and open the project configuration settings.
  2. For Path to application to profile, choose the path to your installed version of the NUnit command-line runner, nunit-console.exe.
  3. In the Working folder field, choose the path to your test assemblies.
  4. In the Application arguments field, enter any arguments you would typically use with NUnit. This includes a space delimited list of your test assemblies. Ensure that you include the /noshadow argument as well.

Your configuration should look like the one in the screenshot below.

Now, simply close the configuration window and click on the run button on the toolbar to execute your tests within NCover Explorer. Your coverage data will load automatically after your tests finish running.

What About The NUnit GUI?

While you could run your tests through the NUnit GUI, it doesn't make much sense to do so. NCover collects data on the application that is running for the duration of its execution, so with the NUnit GUI no NCover data would be returned until the GUI was closed. We generally recommend that developers use the NUnit GUI while running their tests to get them all passing, and then collect coverage data on the tests with NCover Explorer and nunit-console to verify that the tests cover all of their code.

Note to NUnit 2.5.5 users: this version included a bug that prevented NUnit from running multiple instances of nunit-agent in parallel. If you are experiencing no-coverage errors when running multiple instances of nunit-agent, you'll need to upgrade to the latest version of NUnit. See more about this issue here.

If you still need technical assistance, we can help:

Submit A Support Ticket

Try NCover Free Contact Us Online