I’m starting a new project at work and want to learn more about unit testing. We’ll be working with Visual Studio 2008, C#, and the ASP.NET MVC framework. I’m considering utilizing NUnit or the built-in test projects in Visual Studio 2008, but I’m willing to look into other options. Is one system superior than the other in terms of performance or ease of use/understanding?
I’d like to establish this project as a form of “best practice” for our future development efforts.
Asked by Ryan Skarin
All of the advantages of Visual Studio 2008 test projects were listed by Daok. The advantages of NUnit are listed below.
Answered by Mendelt
Because you can transform test classes with separate project files and conditional compilation (like this, Visual Studio NUnit), the unit-testing framework doesn’t really matter.
#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 attractive and reasonably priced… You must find the test from your test class or test list if you are using merely basic Visual Studio 2008. You can run your test directly from the class you’re testing with TestDriven.Net. Unit tests, after all, should be simple to maintain and close to the developer.
Answered by Tuomas Hietanen
The built-in unit testing framework in Visual Studio 2008 has the following advantages and changes:
Answered by Simara
For the past two years, I’ve been using NUnit. Everything is OK, but I have to mention that Visual Studio’s unit testing mechanism is rather nice because it is integrated into the GUI and allows you to easily test private functions without having to fiddle with the code.
Additionally, Visual Studio’s unit testing allows you to perform covering and other tasks that NUnit alone cannot.
Answered by Patrick Desjardins
Visual Studio’s testing framework has one minor drawback: it creates a lot of test run files, which can clutter your project directory. However, this isn’t a significant concern.
Additionally, if you don’t have a plugin like TestDriven.NET, you won’t be able to debug your NUnit (or MbUnit, xUnit, or other) unit tests within the Visual Studio environment, as you can with the built-in Microsoft Visual Studio testing framework.
Answered by Tarsier
Post is based on https://stackoverflow.com/questions/92869/nunit-vs-visual-studio-2008s-test-projects-for-unit-testing