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 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 . Open Source
. Easy to use GUI
. Statistics per test
. Search capabilities across test, output & statistics
. Parameterized & data-based testing
. Rich set of attributes & assertions
. Doesn’t support .NET 4.0 but does for .Net 3.5 & earlier versions
. No autogeneration of test code
. No automatic linking of bugs and need configuration
NUnit xUnit based framework and supports all .NET languages. One of the popular & reliable tool. This is integrated with Resharper .Open Source
. Independent test runner
. Fast
. Integration with 3rd Party tools for continuous Integration( Jenkins etc)
. Selective running of test cases
. Reliable tool
. Reports generation
. Asynchronous execution
. 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 test run
. Features lot similar to NUnit
. Lack of documentation
. Can’t run ignore test manually like Nunit
. Don’t provide text message for failed assertion
. No auto generation of test code

Up Next
    Ebook Download
    View all
    Learn
    View all