I have been using VSTSTest on my current project for around 6 months now and I find that it causes a lot of pain and it has a lot of hacky quirks. I'm not the only one the doesn't like it.
I have decided to see how much effort it would take to switch to an MbUnit/NCover combination here at work.
Using ReSharper I first analyze usages of the Microsoft.VisualStudio.TestTools.UnitTesting namespace. 108 usages, it's everywhere! :(
The first step is going to be to change all of the attributes from the VSTS [TestClass] and [TestMethod]. If Microsoft would have named these according to all the other unit testing suites that came before it I could've skipped this step. Here are the attributes I had to change:
| VSTS Attribute | MbUnit Attribute |
| [TestClass] | [TestFixture] |
| [TestInitialize] | [SetUp] |
| [TestCleanup] | [TearDown] |
| [TestMethod] | [Test] |
| [DeploymentItem] | Change the resource to copy to the output dir |
The next problem that I came across was that our team had a bunch of tests that were testing private methods. For those that don't know VSTSTest generates a file called VSCodeGenAccessors in your test project when you (sigh) right click on a private method and select Create Private Accessor. MbUnit has the ability to test private methods so I had to change all of the tests that used the private method testing to use the MbUnit equivalent:
Reflector.Invoke(objectUnderTest, "PrivateMethod", "parameters");
Now, I am in a compiling state! I run the tests and they all pass. I am free of the shakles!