views:

54

answers:

3

I'm starting to study unit testing now and I'm trying to decide between MS test and nUnit.

What do you recommend me? I'm not an "IT professional", so my knowledge aren't (yet!) so much advanced.

I will implement this in a project with .NET 3.5 using NHibernate, but I'll implement it too in an MVC project.

+2  A: 

Personally, i have used both NUnit and the MS Test framework and though NUnit has been around a bit longer, i think that the MS Testing framework does the trick for me. I think both of them are more or less good enough and its more a question of preference based on what you are more comfortable with.

As long as you are using a Visual Studio version which comes with the MS Unit Testing (till 2008 atleast, VS Standard didnt have it. You had to get the Team Suite) i would prefer MS Test to NUnit just because its part of the whole VS suite of things!

If you are having VS Standard and dont want to fork out the additional for the Team suite, go with NUnit.

BTW, i must add that if you are interested in doing UI testing, WATIN is something that i have had to use additionally in the past and its worked well for me.

InSane
+2  A: 

Between the two, I'd go for NUnit because:

  • it's faster to run
  • more forms of assert (so you don't end up doing Assert.IsTrue() too often)
  • Used more, so more community help available

However, MSTest is better integrated with Visual Studio, particularly for things like code coverage, and you don't have to install extra stuff, so if you're just starting out it might be easier to get going with that.

Grant Crofton
+2  A: 

Similar questions:

My personal opinion, I would use the built in MS Test if:

  1. if you are using Visual Studio 2008 or higher (which has MS Test built in already)
  2. you have no experience yet with a Unit Test suite (and therefore no preference yet)

If you are using Visual Studio 2005 or lower, use NUnit (although I think VS 2005 Team System has a test suite too).

I can't see a reason not just to use the built in MS Test whenver possible. It's very intuitive, and the New Project Wizard has project templates that set your test framework up for you automatically, and I'm pretty satisfied with the way it works.

Using a 3rd party framework like NUnit (which I have also used with VS 2005) is adding another dependency to your solution for no reason IMO.

JohnB