Comparison Of Unit Testing Tools In .NET

Unit testing helps developers to test their code written whether it meets design & requirements and behaves as expected before delivering to QA testing. This will help to identify problems at early stages of the development even though it can’t be replaced with integration testing & performance testing.
 
There are many unit testing frameworks available in the industry. To decide on which one to go for will always be a challenge and we need to choose the right one for our applications. Rewriting the unit test code again later in the lifecycle of the project will become costlier. Decision is a purely personal preference that is best suited for your application/project needs. Listed some of the tools for C# with pros & cons to compare and decide on which one to use for your applications.
 
Tool Description Pros Cons
CSUnit XUnit based framework which supports all .NET languages and integrated with Resharper
. Easy to use GUI
 
. Open Source
 
. Search capabilities across test, output & statistics 
 
. Statistics per test
 
. Rich set of attributes & assertions
 
. Parameterized & data-based testing
. No autogeneration of test code 
 
. Doesn’t support .NET 4.0 but does for .Net 3.5 & earlier versions
 
. No automatic linking of bugs and need configuration
NUnit xUnit based framework and supports all .NET languages. One of the popular & reliable tools. This is integrated with Resharper
. Independent test runner 
.Open Source
 
. Integration with 3rd Party tools for continuous Integration( Jenkins etc)
 
. Reliable tool 
 
. Fast
 
. Selective running of test cases
 
. Asynchronous execution
 
. Reports generation
. Not tightly integrated with Visual Studio
 
. No auto-generation of test code
 
. No automatic linking of bugs and need configuration
MSTest Command-line visual studio unit framework for executing visual studio generated unit tests . Integrates with Visual Studio
 
. Code Coverage is integrated
 
. Build Server is integrated
 
. Auto-generation of unit tests
 
. Automatically links bugs in Team Foundation Server
. Slower
 
. Tricky to integrate with 3rd party tools for Continuous integration
 
. Rich Reporting not available
 
. No asynchronous test execution
XUnit.Net Free and community-based .NET unit testing tool . Freshly written framework for the evolved .NET platform
 
. Flexible & cleaner code
 
. Create Test as Objects instead of methods
 
. Integrated tightly with MSBuild and stop the build in case of any failures in a test run
 
. Features lot similar to NUnit
. Lack of documentation
 
. Can’t run ignore test manually like Nunit
 
. Don’t provide a text message for the failed assertion
 
. No auto-generation of test code