NUnit vs Visual Studio 2008's Test Projects for Unit Testing?
I am going to be starting up a new project at work and want to get into unit testing. We will be using VS 2008, C#, and the ASP.NET MVC stuff. I am looking at using either NUnit or the built in test projects that VS2008 has, but I am open to researching other suggestions. Is one system better than the other or perhaps easier to use/understand than the other? I am looking to get this project set up as kind of the "best practice" for our development efforts going forward.
Thanks for any help and suggestions!!
Daok named all the pro's of VS2008 test projects, here are the pro's of NUnit.
Accorting to Kjetil Klaussen this is caused by the Visual Studio testrunner, running MSTest tests in TestDriven.Net makes MSTest performance comparable to NUnit.
The unit-testing framework doesn't actually matter much, because you can convert test classes with separate project files and conditional compilation (like this, VS->NUnit):
#if !NUNIT using Microsoft.VisualStudio.TestTools.UnitTesting; #else using NUnit.Framework; using TestClass = NUnit.Framework.TestFixtureAttribute; using TestMethod = NUnit.Framework.TestAttribute; using TestInitialize = NUnit.Framework.SetUpAttribute; using TestCleanup = NUnit.Framework.TearDownAttribute; using TestContext = System.String; using DeploymentItem = NUnit.Framework.DescriptionAttribute; #endif
The TestDriven.Net plugin is nice and not very expensive... With only plain VS2008 you have to find the test from your test class or test list. With TestDriven.Net you can run your test directly from the class that you are testing. After all, unit test should be easy to maintain and near the developer.
Benefits/changes of VS2008 Built-in Unit Testing Framework