Monday, April 26, 2004

It is very easy to compute the code coverage of the Unit tests using MbUnit and NCover.

  1. Install the latest version of NCover (from gotdotnet: http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=3122ee1a-46e7-48a5-857e-aad6739ef6b9 )
  2. Create a test assembly and compile it in debug mode. NCover needs the symbol files to work (.mdb)
  3. Launch NCover as follows:
    NCover.Console.exe /c "MbUnit.Cons.exe" "MyTestAssembly.dll" /a "TheAssemblyToComputeTheCoverageOn"

    where MyTestAssembly.dll is the unit test assembly, TheAssemblyToComputeTheCoverageOn is the name of the assembly to compute the code coverage on (without the .dll extension)

  4. That' it.
 

You can launch multiple test assembly by providing multiple assembly names. And you can monitor multiple assembly, by providing a ;-separated list of assemblies.

 

posted on Monday, April 26, 2004 9:03:00 AM UTC  #    Comments [6]
Tracked by:
"christian dating man" (online) [Trackback]
"temptations my girl mp3" (online) [Trackback]
Monday, June 06, 2005 6:10:16 PM UTC
Cool blog!
<br>However, it seems I am the second guy who make comments here.
<br>^_v?!
xxxyyyzzz
Monday, June 06, 2005 6:10:17 PM UTC
Blog is still young...
Jonathan de Halleux
Monday, June 06, 2005 6:10:18 PM UTC
Is NCover and <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> still working together? I have an NUnit project that works fine with NCover. If I make just the absolute minimum number of changes to get one test working with <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a>.cons and NCover, the coverage.log file starts showing the following line: &quot;MESSAGE: Failed to load symbols for module [testcoverasm.dll] in [c:\projects\testcoverasm\target].&quot; and coverage shows up empty. I am wondering if the recently added shadow copying (<a target="_new" href="http://blog.dotnetwiki.org/archive/2004/07/18/607.aspx">http://blog.dotnetwiki.org/archive/2004/07/18/607.aspx</a>) might be causing some problems for NCover? I noticed if I use cordbg.exe to load <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> the symbols for TestCoverAsm get loaded, just not when running it with NCover. I posted the files I'm using in a very simple test below:
<br><a target="_new" href="http://blogs.pingpoet.com/overflow/archive/2004/07/28/680.aspx">http://blogs.pingpoet.com/overflow/archive/2004/07/28/680.aspx</a>
Scott Willeke
Monday, June 06, 2005 6:10:19 PM UTC
I finally figured out how to fix this. The solution is at the link below:
<br><a target="_new" href="http://blogs.pingpoet.com/overflow/archive/2004/07/28/680.aspx">http://blogs.pingpoet.com/overflow/archive/2004/07/28/680.aspx</a>
<br>I'm not sure why this was working with NUnit?
Scott Willeke
Monday, June 06, 2005 6:10:20 PM UTC
I'll be checking that as soon as I get the time...
Jonathan de Halleux
Monday, June 06, 2005 6:10:21 PM UTC
off course.. NCover and <a title="MbUnit, Generating Unit Testing and Model Based Testing Framework for .NET Framework" href="http://mbunit.tigris.org" target="_blank">MbUnit</a> still working.. perfect working
se
Comments are closed.