Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nunit and code coverage for C#

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?

like image 375
George2 Avatar asked Oct 19 '10 09:10

George2


2 Answers

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

like image 155
stack72 Avatar answered Oct 10 '22 07:10

stack72


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

like image 25
Sebastian Piu Avatar answered Oct 10 '22 07:10

Sebastian Piu