How to get Code Coverage on DLLs

How to get Code Coverage on DLLs

Hi, I've downloaded NCover 1.5.8. I want to see the code coverage of Dot Net (C#) modules in our code repository. (For the sake of an example)In terms of directory structure we've a parent directory named "Parent" and it contains two sub-directories namely; "SampleModule" and "SampleModule.Test".

So above indicates that we've a SampleModule and all of its unit tests are in directory named "SampleModule.Test". Now please pardon my ignorance as I'm naive when it comes to code coverage in .NET. Directory "SampleModule.Test" contains a DLL and I'm just guessing that I should plug this DLL into NCover to get the complete code coverage on module named "SampleModule", does that sound right? If it's true then I'm trying this and it's not working, here is my screen dump

C:\Program Files (x86)\NCover>ncover.console //a c:\parent\SampleModule\dlls\SampleModule.dll NCover.Console v1.5.8 - Code Coverage Analysis for .NET - http://ncover.org Copyright (c) 2004-2006 Peter Waldschmidt

Error: You must specify a command to execute.

Usage: ncover.console [ []] [//svc ] [//iis] [//v] [//q] [//a ] [//l ] [//x ] [//s []] [//r []] [//w ]

   Example command line to launch profiled application
     ncover.console myapp.exe arg1 arg2
     ncover.console //svc MyService
     ncover.console //iis

   NOTE: Any command line parameters that do not start with '//'
         are passed to the profiled application on its command line.

//a List of assemblies to profile separated by semi-colons i.e. "MyAssembly1;MyAssembly2" //w Working directory for profiled application //ea List of attributes marking classes or methods to exclude from coverage

//reg Register profiler temporarily for user. (helps with xcopy deployment) //l Specify profiler log file //x Specify coverage output file //h Specify HTML report output path //pm Specify name of process to profile (i.e. myapp.exe)

//s Save settings to a file (defaults: NCover.Settings) //r Use settings file, overriding other settings (default: NCover.Settings)

//q No logging (quiet) //v Enable verbose logging (show instrumented code)

C:\Program Files (x86)\NCover>


Two questions 1- Does my approach sound right in terms of producing code coverage reports for "SampleModule"? 2- Why is above not working?

Please pardon my ignorance & enlighten me. I will really appreciate your help.

Thanks.


RE: How to get Code Coverage on DLLs

One more thing. SampeModule.Test (that contains all tests) is a Class library project.


RE: How to get Code Coverage on DLLs

ncover should execute the testrunner for whichever test framework you're using. Are you using NUnit or MSTest or some other tool to write tests?