Monday 22 June 2009

Gallio & NCover

There are a lot of posts around on the internet regarding how to gather coverage data from unit tests running in Gallio. I have spent all evening trying to get them working and have found that some of the command lines that appear to work for everyone else simply don't work for me, specifically they may run the tests but provide no coverage data or, more commonly, simply don't run the tests at all.

But i have cracked it now, so in order that I don't forget, I'm going to record it here!

To run the command line "Gallio.Echo.exe" to gather coverage data using NCover 1.5.8 simply use:


Gallio.Echo.exe /r:NCover TestAssembly.dll


It really is that simple! You may/should be able to do it using NCover.Console.exe and passing in a few parameters, but this is by far the simplest and most reliable way of doing it! You should be able to use the


/runner_property:NCoverArguments='TestAssembly.dll'

to tell NCover which assembly to provide coverage data for, as this command line will include coverage data for your tests and some of the Gallio code as well as the code under test, but I haven't got that bit working yet!