Which Unit Test framework to use with VSTS – MSTest or NUnit

Unit Testing is the core of TDD and it requires a lot of collaboration and communication among developers. One of the most debated topics among developers is "Should we use MsTest or NUnit?"

People agree on disagreement and have their own preferences/reservations as per their point of view. In this Blog post, I am trying to highlight some of the differences which might be helpful for you to take your call. I personally used to prefer NUnit in past. However - later I realized that with the new set of tests like Coded UI Test, Load Test, Web Performance Test etc - it is better to use MsTest from within Visual Studio. Makes your life more easier - especially when you want to debug your unit tests.




Writing Test Cases and Integration with Visual Studio

Direct support within VS IDE to click and create the test skeleton. Automatically integrated with Visual Studio IDE.

Not Directly Integrated in IDE out of the box. Paid tools are available for this integration like Resharper/TestDriven.Net for this integration

Support for Standalone Installation

Standalone Installer for MsTest is not available.

NUnit provides a standalone installation

CC.NET Integration

CC.NET provides a separate task to run MSTests along with the build.

CC.Net provides a separate task to run NUnit Tests

Code Coverage

Inbuilt with Visual Studio and Code Coverage calculations are automatic for MSTest.

For NUnit , code coverage needs to be calculated using NCover.

Ease of Use

Depends on Programmer

Depends on Programmer

Mocking tool support

Supports most of the mocking tools like MoQ/ NMock/ RhinoMock etc..

Supports most of the mocking tools like MoQ/ NMock/ RhinoMock etc..

Readability Enhancements

No additional support. Depends on developer

More Readable Tests with NUnitEx

64 bit application support

MSTest doesn’t support 64 bit dlls.

NUnit does support 64 bit dlls

Test Runs

Need Visual Studio too run and see the test reports.

Standalone application to run the tests.

Test Integration with Test Lab / VSTS

Direct Support.

Need custom/paid tools

Behaviour Driven Design

Not supported (need extra efforts)


3rd Party Tool Support

Very limited

NUnit is probably the most supported by the 3rd party tools

Debugging Test

Easier to debug test as it directly runs tests within Visual Studio

Needs more efforts as you have to attach the dll etc

Solution & Test Config Settings

Config Settings are automatically added to the solution as part of the solution folder.

Need to add the config files manually.

 Here is a list of comparison on Assertions and Attributes for various Unit Testing Frameworks


Comments (0)

Skip to main content