http://www.ncover.org/downloads.html
NCover is a code coverage tool that runs straight out of the box on your production dlls. No pesky slow instrumentation builds. At run-time it intercepts CLR calls and adds what it needs on the run. Cool !
Getting it to run is another matter altogether. After a couple of frustrating attempts,
(there's a Win32Exception that's just top of the pops.) I think I have got it to run now with NUnit.
So I get automated tests with Code Coverage. Now is that cool or is that cool ? 8)
Running NCover.Console.exe:
use the /w to specify a working directory
Use the /a switch to specify semicolon delimited list of DLLs that it should monitor. By default, NCover will take all it finds in the directory. Use /a to prune the list.
Use the /c switch to specify a command line op that will run thru your code-base. Could be your Main executable or a test app or ... you guessed it NUnit at work!
"e:\Program Files\NCover\NCover.Console.exe" /w "G:\Dev\TestApplications\AutomatedTests\TestDlls\debug" /a GCommon;Licensing /c "e:\Program Files\NUnit 2.2.4\bin\nunit-console.exe" LicenseTests.nunit
Where I messed up
- NCover doesn't like you "helping" it by giving complete DLL Names. So no 'licensing.dll' instead use 'licensing'
- Specify the complete path to NUnit - it helps.
- The coverage log (linked to coverage.xsl by default) caused some kind of problems for browsers. To get around, open up the xml in an editor and remove all instances of '�' I think that this caused the hyperlinks in the document to blow up but atleast you can now view the coverage report. Dunno why this is so... will post on NCover forum
And last of all,
Get the style sheet from http://blog.hishambaz.com/archive/2004/07/05/153.aspx
To use it, open coverage.xml and modify the stylesheet ref
... ?xml-stylesheet href="coverage2.xsl" ...
Save & Open the file in a browser and you are done. IE gave some active content warning and blanked on enabling active content. No such hassles with Firefox :)