That’s pretty easy to switch from MsTest to NUnit (or other xUnit framework, but I’ve decided I want NUnit). You need to do following steps:
The note is (if you don’t know) that there’s no build-in runner for Visual Studio (unlike MsTes), so you’ll need to run tests:
- Change the Visual Studio project type:
- Unload the project with tests.
- Remove <ProjectTypeGuids> node from there.
- Save and reload the project.
- Replace Reference from MsTest to your xUnit.
- Replace using statements (Remove Microsoft.VisualStudio.TestTools.UnitTesting, add NUnit.Framework and optionally NUnit.Framework.SyntaxHelpers).
- Replace (just use Find and Replace in Files) [TestClass] to [TestFixture].
- Replace [TestMethod] to [Test].
- Replace [TestInitialize] to [SetUp].
- Replace [TestCleanup] to [TearDown]
- Now you should be able to compile the tests.
- Clean all the stuff from MsTest (TestResults folder, Solution Items that describe test data).
The note is (if you don’t know) that there’s no build-in runner for Visual Studio (unlike MsTes), so you’ll need to run tests:
- from outside of Visual Studio by GUI runner
- using TestDriven.NET
- using ReSharper.