Testing With NCover/NCoverExplorer

The following screencast demonstrates how to achieve 100% coverage using TestDriven.NET 2.0, NCover and NCoverExplorer. Peter Waldschmidt and Grant Drake very kindly agreed to let me distribute NCover and NCoverExplorer with the RTM version of TestDriven.NET 2.0. This means that once TestDriven.NET is installed, there is nothing more to configure. Code coverage with NCover can be used from Visual Studio .NET 2002, 2003 or 2005. It is possible to use NCover if only .NET 1.1 is installed, however .NET 2.0 is recommended. If only .NET 1.1 is installed then NCover 1.3.3 will be used rather than the more mature NCover 1.5.6.

In the screencast I start off by showing how to zoom in on the partially covered regions of code. I then navigate back to Visual Studio and expand my unit test to cover all of the partially covered method. Rather than create a unit test for the ToString method, I decide to use the 'Coverage Exclude' feature of NCover 1.5 (TestDriven.NET uses "//ea CoverageExcludeAttribute" by default). I create a new CoverageExcludeAttribute and use it on the ToString method (extra assembly references are required). This enables me to achieve 100% coverage with the excluded code grayed out and not counted in the final coverage score.

 

You can watch the screencast here.

I'd like to thank Grant Drake in particular for his support, generosity and convincing me that it was worth carrying on with the project. :-)

Published Saturday, November 11, 2006 8:29 AM by Jamie Cansdale

Comments

# re: Testing With NCover/NCoverExplorer

Looks great (again!)

One question regarding the coverage configuration. Most of the unit testing I work with is in a separate DLL to the code being tested. Normally I have a script that fires off NUnit with NCover on the test (e.g. App.UnitTests.dll) and target DLL (e.g. App.Common.dll). That way I see the coverage on both the tests and the tested code.

Is there a way to configure that through TestDriven.NET or will I need to continue doing the separated DLL test manually?

Tuesday, November 21, 2006 4:54 AM by Paul Kohler

# PK Software Blog - Testing With NCover/NCoverExplorer Screencast

# re: Testing With NCover/NCoverExplorer

Great screencasts Jamie !!

God way to teach us to use all the potential of Testdriven !!

Let me ask you an offtopic: what screen record program are you using to create these screencast, sorry for ask, and you cant of course don't ask it to me.

Cheers and keep in the outstanding work

Marcos

Friday, November 24, 2006 3:24 PM by Marcos

# re: Testing With NCover/NCoverExplorer

Hello Jamie,

is it possible to specify the exclude attribute used by TestDriven.Net? I would like to exclude all the designer generated methods, which are marked with the System.Diagnostics.DebuggerNonUserCodeAttribute.

Best regards Dirk

Wednesday, November 29, 2006 4:55 AM by Dirk

# re: Testing With NCover/NCoverExplorer

Paul - by default it will do coverage on all assemblies with PDB info in the output directory. It should behave as you expect. It is possible to exclude the test assembly from inside NCoverExplorer.

Thursday, December 07, 2006 4:28 AM by Jamie Cansdale

# re: Testing With NCover/NCoverExplorer

Marcos - the screencasts were done using BB Flashback.

Thursday, December 07, 2006 5:19 PM by Jamie Cansdale

# re: Testing With NCover/NCoverExplorer

Dirk - I'm afraid there's no way to specify a different attribute at the moment. I'll add that as a feature request.

Thursday, December 07, 2006 5:22 PM by Jamie Cansdale

# re: Testing With NCover/NCoverExplorer

Does ncover support asp.net 2.0 ?

I can't profile the asp.net 2.0 web site application...How to do ?

Wednesday, March 28, 2007 5:56 AM by globe

# re: Testing With NCover/NCoverExplorer

I've done everything in the screencast but it won't exclude any methods. What could I be doing wrong? Do I need particular versions of the softwares?

Monday, June 25, 2007 1:18 AM by James Cook

# re: Testing With NCover/NCoverExplorer

Testing With NCover_2F00_NCoverExplorer.. Great! :)

Thursday, May 12, 2011 8:49 AM by weblogs.asp.net

# re: Testing With NCover/NCoverExplorer

Testing With NCover_2F00_NCoverExplorer.. Tiptop :)

Sunday, June 26, 2011 11:17 AM by weblogs.asp.net

# re: Testing With NCover/NCoverExplorer

Wednesday, October 19, 2011 2:43 AM by xlwtdvzt

# re: Testing With NCover/NCoverExplorer

Thursday, November 10, 2011 3:58 AM by abzbcsru

# re: Testing With NCover/NCoverExplorer

<a href=http://www.nfljerseysleague.com> new nfl jerseys</a>

Friday, November 11, 2011 3:04 AM by hcsybeua

# re: Testing With NCover/NCoverExplorer

Tuesday, November 15, 2011 3:59 PM by nkynvtnf

# re: Testing With NCover/NCoverExplorer

<a href=www.nfl2012jerseys.com/nhl-jerseys>wholesale cheap jerseys nfl.com</a>

Monday, December 05, 2011 10:51 PM by zwbdaovl

# re: Testing With NCover/NCoverExplorer

<a href=www.goodsgoodsale.com/index.php Jerseys sale,</a>

Thursday, January 05, 2012 3:45 AM by wtqrytvi

Leave a Comment

(required) 
(required) 
(optional)
(required)