.NET unit testing essentials – Integrated test Runners

Unit testing success is determined by several factors: the project, team commitment and the tools used. Having a unit testing framework is a must, having an easy way to run your tests is just as important.

Although every single unit testing framework in the market has way to run tests from a console and a dedicated GUI it’s a quite a hassle switching between Visual Studio (where you write the tests) and the place where you run your tests.

Over the years I’ve used several runners but among them there are three runners I prefer:

MSTest

If you’ve been using Microsoft’s unit testing framework that’s bundled at part of visual studio then you already have an integrated runner to run all of these tests.

The upside is that you have a test list editor and can run all of the tests in the solution by pressing a single key combination. It has integrated test coverage support and like the other runners you can also debug the tests.

Unfortunately it won’t run other framework’s tests – so if you’re planning on using NUnit or XUnit you probably need another test runner.

R# Test Runner

JetBrains has a unit test runner as part of the amazing ReSharper tool. First and foremost it has a very good visual studio integration – just like I come to expect from ReSharper, it has a unit test explorer that is refreshed with new unit tests as if it was built as part of visual studio.

It runs NUnit and MSTest tests (and even has XUnit support via add-in) and if you have JetBrains DotTrace profiler you can profile your tests as well.

The fact that it’s part of a ReSharper and that it can run NUnit and MSTest tests is probably the reason it was voted as the most used .NET test runner in the following poll.

TestDriven.NET

This one is my all time favorite, this test runner does it all – not only does it runs tests written by almost any .NET testing framework there is it enable visuals studio integration of several well used tools:

it’s the only runner I know that can run as a 64bit process from within visual studio.

The only catch is that you have to buy it if you want to use it for commercial use, but it’s well worth the cost.

Conclusion

I’m sure there are other alternatives out there and choosing the right runner for your project is just a matter of trying some of them to see which you prefer most. I hope that this post will help you decide which runner to use.