Solved

C# NUnit Code Coverage

Posted on 2008-10-20
8
2,724 Views
Last Modified: 2013-12-17
I am using NUnit to test my C# code, and I was wondering how I could find out what code I have and have not tested.
0
Comment
Question by:RishadanPort
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 16

Assisted Solution

by:CuteBug
CuteBug earned 125 total points
ID: 22763546
0
 
LVL 10

Expert Comment

by:oxyoo
ID: 22764465
There is also this open source project, but I think that this has stopped being developed (Last Update: Jun 15 2004). I did use this project in my earlier projects and it worked fine, now I am using the version that CuteBug is referencing and it seems to have more features.

http://ncover.sourceforge.net/

Good Luck!
0
 
LVL 6

Author Comment

by:RishadanPort
ID: 22771100
Can these be used in with my NUnit tests? If so how?
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 10

Accepted Solution

by:
oxyoo earned 375 total points
ID: 22774182
Yes they can, and that's in my opinion the main purpose of NCover. Basically what I do is that I use CruiseControl.Net and have NAnt (MSBuild will work fine too) build scripts to compile project, run nunit tests, run ncover, etc and then display all the NCover results in the CC.Net dashboard. It takes some time to setup though, as CC.Net uses a lot of config files (TeamCity might be an easier approach with a nicer UI).

Integrating NCover results in CruiseControl.Net
http://www.ncover.com/documentation/howto/ccnetintegration

Run NCover from Visual Studio (video)
http://www.ncover.com/documentation/howto/run_ncover_from_vs


If you decide to go with commercial NCover, it will include a GUI application that will spit out all the NAnt, MSBuild, and even command line syntax to run NUnit and NCover together.

Hope that helps.
0
 
LVL 6

Author Comment

by:RishadanPort
ID: 22815478
Is there any chance somebody here could help me set it up the Graphical NCoverExplorer? I am having lots of problem setting it up because the documentation on the website is not great.
0
 
LVL 6

Author Comment

by:RishadanPort
ID: 22815609
I think I finally figured out how to do the command args properly... and it correctly shows which lines have been executed and which have not. Thanks a lot for the help
0
 
LVL 6

Author Comment

by:RishadanPort
ID: 22815877
What do these other tools, such as CruiseControl, NAnt ... specialize in that this NCover can't do? Looking at the interface, it did quite a good job finding which lines got executed and which didn't.
0
 
LVL 6

Author Closing Comment

by:RishadanPort
ID: 31508093
Thanks a lot, works like a charm
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question