Many of us are using NUnit and want to use Microsoft’s MSTest. I am writing a little about the difference between NUnit and MSTest and what changes you need to make to migrate from NUnit to MSTest. I hope this article will help you understanding the difference and assist with migrating.
NUnit is an open source unit testing framework for Microsoft .NET; basically, you can achieve the same goal as with MSTest. The main difference for me; MS provides unit testing toosl only in the team edition of VS. NUnit is free.
Yes, Team Edition unit testing tool is a bit more capable. For example, you may easily generate (stabs for) tests. It is easy to check test coverage etc. You can't do that with standard GUI for NUnit. If you want to convert or user your project from NUnit to MSTest then you need to change the following.
Replace the reference to the Nunit.Framework assembly with a reference to the Microsoft.VisualStudio.Qua
Replace the “using Nunit.Framework” line with “using Microsoft.VisualStudio.Tes
For each file containing unit tests, replace the following attributes (you can use global search and replace for this):
NUnit Attribute for
Replace the following method calls:
NUnit Method Code for
MSTest Method Call
Unfortunately, the Assert (and related classes) used by MSTest are not as complete as the ones offered by NUnit so you may also end up changing some of your tests. The following Asserts are not available in MSTest:
If you want to use NUnit then you can use couple of third party plug-in to use NUnit from Visual studio. Also If you are using ReSharper then you can run the NUnit Unit test cases directly from the Visual Studio IDE.
I have used both for the basic stuff I liked both but as I was use to with NUnit I would still prefer to use NUnit. And Microsoft has added MStest with VS its really good that you can just run the Unit test cases by right click on class or methods. But the similar functionality you can achieve if you have ReShaper. As I was using ReSharper, I found using NUnit for my current project.
I will make the changes... as you have suggested ...