As Microsoft finally added out-of-the-box support for other Testing Frameworks to Visual Studio, I found it was time to move away from MSTest. I spend some time looking at xUnit but in the end I decided to go for NUnit.
To convert all my tests I started with a simple find and replaces to switch things like [TestMethod] to
So I had to change:
to:
To convert all my tests I started with a simple find and replaces to switch things like [TestMethod] to
[Test] and [ClassInitializer] to [TestFixtureSetUp].After everything was converted and compiling nicely I ran into a problem when executing the tests. Any test that used [TestFixtureSetUp] or [TestFixtureTearDown] were just being skipped by the test runner with the error: “Invalid signature for SetUp or TearDown method: SetUp”In the NUnit documentation I found the reason, MS Test uses static methods for its class initializer whereas NUnit requires instance methods.
So I had to change:
[TestFixtureSetUp]
public static void SetUp() {...}to:
[TestFixtureSetUp]
public void SetUp() {...}