views:

70

answers:

3

Hello everyone,

I am using C# + .Net 4.0 + VSTS 2010. I am wondering whether Nunit is the best and easy to learn unit test tool for this platform (C# + .Net 4.0 + VSTS 2010)? If yes, I want to learn basics of Nunit, and also want to find how to generate code coverage report based on Nunit result (e.g. code coverage report to show which function is tested, which function is not tested, how many lines are tested.)

Any recommended tutorials for Nunit and code coverage for a newbie?

thanks in advance, George

+3  A: 

I sent this tutorial on NUnit for beginners to some juniors I work with

http://www.dotnetspider.com/tutorials/NUnit-Tutorials.aspx

also coverage is something I wouldn't quite worry about for now until you get to grips with unit testing. There are more things involved in unit testing like dependency injection and mocking frameworks to make sure that code gets covered and is testable.

personally id work on integration and unit testing first and then move in coverage - just my 2 cents

hope it helps

paul

PaulStack
Thanks Paul! I see the tutorial is about Nunit, could you also recommend some coverage reporting tutorials to me?
George2
may be useful to look at NCover (its not free) but has a good section on how to get started with code coverage http://docs.ncover.com/how-to/getting-started-with-code-coverage/
PaulStack
Hi Paul, I read the nunit tutorial you recommended to me. I find it is just a general introduction, and what I want to learn is a tutorial which is step-by-step guide to tell me how to nunit to do unit test for some specific code samples. Any recommendations? Thanks.
George2
ill help you if you want - my mail address is paulstack [at] hotmail [dot] com - mail me what you want to do and ill help you out :)
PaulStack
Hi Paul, thanks in advance. I want to learn by myself and save your time. Appreciate if you could recommend me a step-by-step tutorial for nunit. :-)
George2
if you can afford it buy a book called 'The Art of Unit Testing' http://amzn.to/9q2DZl - otherwise try this out - http://www.4guysfromrolla.com/articles/011905-1.aspx - its very difficult to suggest things for this. the book will 100% help as its fantastic. Never feel as though you would be wasting my time. We all need help to get in the right direction :)
PaulStack
Thanks, question answered!
George2
glad the question was answered - you have my mail address if you need anything - paul
PaulStack
+1  A: 

for code coverage you can use ncover, there is a nice integration into VS that is called testdriven.net. If you are on VS 2010 you might also want to check the builtin test framework (MSTest) that also has coverage builtin

hope it helps seba

Sebastian Piu
Cool, could you recommend a tutorial for ncover for a newbie like me?
George2
sure, check here: http://docs.ncover.com/
Sebastian Piu
oops, sorry. Didn't meant to send just that :). I'd skip the command line section of how loading the xml into the report explorer, as this is quite simple when using testdriven.net. Also, note that if you use the VS 2010 integrated one you can see the highlighted code directly on VS, oposed as ncover that opens a different program.
Sebastian Piu
Thanks! I find the getting started guide is very helpful. I also want to learn nunit, and could you recommend a step-by-step guide to tell me how to nunit to do unit test for some specific code samples? Thanks.
George2
A: 

The company that makes ReSharper (JetBrains) now has their own coverage tool called dotCover. As of now, I think dotcover and Resharper combined are less expensive than ncover.

bluevoodoo1