How to run Unit Tests in Visual Studio?

NUnit does not currently have a plugin for Visual Studio that allows you to run test right from Visual Studio. However, it can be done.

You can use a number of tools but the tool I prefer is TestDriven.NET.

Step 1 – Download and Installation

  1. Go to the TestDriven.NET web site.
  2. Click the download link.
  3. Download the appropriate version (Enterprise, Professional, or Personal).
  4. Close Visual Studio.
  5. Install TestDriven.NET.

Step 2 – Running Unit Tests

  1. Open your solution that has a test project in Visual Studio.
  2. Right-click on your test project and you should see a Run Test(s) and a Test With option.
  3. Select Run Test(s).
You are now running tests just by right-clicking in Visual Studio.

Notice that you can also run tests in the Debugger and with Coverage and with Performance.

One Comment

  1. Dan says:

    Thanks for this article. I needed a quick rundown on getting unit tests started. I was debating doing MSTest but decided to go with with Nunit. For your next blog post how about a simple Ling to Entities tutorial 🙂

Leave a Reply

How to post code in comments?