Visual Studio: Run all tests in a single project?

Jon Schneider picture Jon Schneider · Nov 5, 2015 · Viewed 10.7k times · Source

In my Visual Studio solution, I have about a dozen projects, several of which contain unit test methods (tagged with the TestMethod attribute), with several hundred test methods spread across those projects.

From within Visual Studio, I'd like to run all of the (100+) tests in one particular project in the solution, without running the tests in the other projects in the solution.

Ctrl+R, A doesn't do what I want, since that runs all tests in the entire solution. I also don't see any options to run tests in a particular project in the Test menu, in the Test Explorer window, or in the right-click context menu for a project in the Solution Explorer window.

I'm using Visual Studio 2013.

What's the best way to get Visual Studio to run all of the test methods in a particular project?

Answer

Jon Schneider picture Jon Schneider · Nov 5, 2015

After some additional poking around the UI, I figured out a decent way to do this:

  1. Open the Test Explorer window. (Test menu > Windows > Test Explorer)
  2. Click on the little down arrow just to the left of the search field.
  3. From the context menu that appears, select Project. The Test Explorer window contents change to be grouped by project in a 2-tier hierarchy.

Test Explorer filter menu

  1. Right-click on the desired project.
  2. From the context menu that appears, click Run Selected Tests.

Test Explorer project context menu

I'd still like a reasonable way to do this with only the keyboard, though!