.NET Unit Testing Tools


There are no silver bullets in our chosen profession, software engineer. Select tools and technologies that meet your requirements. When adopting tools, be prepared to align your workflow with the tool’s happy path.

If you can’t find a tool that meets your requirements, write one.  I’ve done this many times over the years and so have thousands of our fellow developers.

At work, I spend 100% of my time on C# .NET application design, architecture, and coding. After work, it’s JavaScript and .NET.

I’ve found a sweet spot for my JavaScript development that I’ve written about in these two recent blog posts:

When writing JavaScript applications, I like that my tests run automatically any time I save a code or test file. Automatic is the operative word, not having to run an additional command for my tests to run saves time and effort.  The test results appear in a command line window.  Automatic test running enables simple red-green-refactor workflow written about by so many developers and unit test advocates.

Additionally, I’ve  grown fond of the BDD style assertions that the Chai library offers.

.NET Red-Green-Refactor Workflow

This section is about setting up a red-green-refactor code-time workflow. None of the below content applies to setting up a CI Server that performs continuous integration and testing services.

I’ve started work on my Ocean Framework that I originally published by in 2007. Back then I didn’t provide unit tests, a mistake I’m now correcting. I’ll write much more about Ocean and other WPF projects later in the year.

My workflow goal is:

  • Visual Studio automatically running the unit tests
  • BDD style assertions
  • Unit test framework that supports Xamarin, WPF, and C# libraries

I did my research and found that JetBrains Resharper Ultimate when combined with JetBrains dotCover provides .NET developers the capability to have a simple Continuous Testing workflow. Since I already have a JetBrains Ultimate license, this was an easy decision.  I also use JetBrains WebStorm and dotPeek products.

JetBrains Continuous Testing workflow enables developers to write code and unit tests, and when the files are saved automatically run the unit tests. Continuous Testing only runs tests that are impacted by a code or unit test change. When I have a project that has a thousand or two thousand unit tests, I’ll write a  blog post with the results of the time savings as well as the required system resources to support this feature.

Code coverage report is generated when tests are run and is viewed in the same tool window as the test results. The coverage report tool can also highlight your code, visually indicating the lines of code covered and not covered by the last unit test run. Nice feature when you’re driving for 100% coverage.

Continuous Testing has several options for triggering when tests are run.  I’m currently using the On ‘Save’ Build and Run Dirty Tests option as it meets my workflow requirements. Choose the option that best meets your workflow requirements.


Continuous Testing allows developers to deselect assemblies or parts of assemblies not to run tests or coverage for, which is a fabulous feature for the red-green-refactor workflow as it cuts down the test run time significantly on large projects.

I should note, that Visual Studio has these same capabilities to run unit tests and provide code coverage report as well other excellent code analysis tools. You can quickly set up a shortcut key for running your tests on demand.  I could not figure out how to do this automatically. I did think about setting up a file watcher and then running the unit tests from the command line when a file is saved. Since JetBrains Continuous Testing does this for me, as well as only running the tests affected by files that are saved, I’ve selected this tool.

Choose the tools that meet your requirements and align with your workflow. If you like the Visual Studio tools, please use them.  No need to purchase tools if you don’t need them.

Tool Choices

I’ve chosen these libraries to round out my tooling selection. Use NuGet to install them the solution test assemblies.

Please do your research and select tools that meet your requirements and enable an effective code-time workflow.


Reviewing daily workflow scenarios for efficiency and accuracy is an important task for developers and developer leads. Forming habits that make you efficient increases your value in the marketplace. Work smarter not harder.

Have a great day,

Just a grain of sand on the world’s beaches


One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s