Geeks With Blogs
Lee Brandt's Blog You're only as smart as your last line of code

I was trying this morning to run NCover (for the first time). I downloaded a eval copy (sweet!) and then opened NCover Explorer only to find myself a little lost. So I thought I'd RTFM a bit first. That helped (a little), and the documentation online also helped some, but what I really needed to do was check my MSTest test coverage of my base framework. The documentation really only covered generic scenarios and a little bit of googling only left me wanting. All these little bits and pieces, however, led me to make some educated guesses about what to put in the configuration for NCover and... success! So I thought I'd share, in case it helps someone else.

 

Open NCover Explorer.

Click on the "Run NCover" button on the toolbar or hit Ctrl+N [NOTE: Not the "Run NCover Now" button]

You should be presented with a configuration options screen (see Fig 1)

Set the "Path to application to profile" box to MSTest.exe file (Usually, C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe)

Set the "Working Folder" to the bin directory of your framework project: (Mine is: C:\svn\CodeBase\trunk\src\CodeBase\bin)

Set the "Application Arguments" to /noisolation /testcontainer:[test_project] where test_project is the path to the DLL of your test project (Mine looks like: /noisolation /testcontainer:C:\svn\CodeBase\trunk\src\CodeBase.Test\bin\Debug\CodeBase.Test.dll )

That's it!

You should now be able to click on the "Run [F5]" button at the bottom there and it will start the sample application, run the tests and give you a code coverage result that shows how much of your framework was exercised by your unit tests.

 

Hope this helps someone!

~L

 

[Fig 1]

NCoverOptions

Posted on Thursday, May 15, 2008 1:47 PM TDD , Learning , Software | Back to top


Comments on this post: NCover with MSTest

# re: NCover with MSTest
Requesting Gravatar...
It's even better when you use TDD.Net (personal or commercial) and can do this right from the IDE. :D
Left by Robz on Jul 21, 2008 8:38 PM

# re: NCover with MSTest
Requesting Gravatar...
Thanks for this, the /noisolation was what i was missing meaning all the code coverage results were greyed out.
Left by Frank on Sep 01, 2008 4:32 AM

# re: NCover with MSTest
Requesting Gravatar...
Exactly helpful! Great work!
Left by Hants on Sep 06, 2008 12:56 AM

# re: NCover with MSTest
Requesting Gravatar...
Aye it has, thankee! :)
Left by Jax on Sep 23, 2008 6:31 AM

# re: NCover with MSTest
Requesting Gravatar...
I'm so glad you guys have found this helpful.

~Lee
Left by Lee Brandt on Sep 23, 2008 1:47 PM

# re: NCover with MSTest
Requesting Gravatar...
You help me a lot, great thank to you :)
Left by TOX on Apr 07, 2009 2:17 AM

# re: NCover with MSTest
Requesting Gravatar...
You're welcome @TOX. I am glad this helped,

~Lee
Left by Lee Brandt on Apr 07, 2009 7:39 AM

# re: NCover with MSTest
Requesting Gravatar...
I did exactly as specified . But i get the following error message when i hit F5

YOU MUST SPECIFY A REPORT TYPE FOR /r SWITCH . EXITING WITH RETURN CODE :2

Any idea why this happens

Left by rachel on Dec 09, 2009 10:27 AM

# re: NCover with MSTest
Requesting Gravatar...
Thanks for this post Lee. Your post solved my problem.
Left by Devendra on Jul 12, 2010 12:46 AM

# NCover with Nunit test
Requesting Gravatar...
Hi,

I am getting below error while running ncover in command promt

Error :"YOU MUST SPECIFY A REPORT TYPE FOR /r SWITCH . EXITING WITH RETURN CODE :2 "

Please help me to sove this issue.

Thanks & Regards,
Babu
Left by Babu on Dec 31, 2012 4:33 AM

Your comment:
 (will show your gravatar)


Copyright © Lee Brandt | Powered by: GeeksWithBlogs.net