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?
To run all the tests in a solution, choose the Run All icon (or press Ctrl + R, V).
In the new project dialog box, find the unit test project to use. Type test in the search box to find a unit test project template for the test framework you want to use, such as MSTest (C#) or the Native Unit Test project (C++), and select it. Starting in Visual Studio 2017 version 14.8, the .
TestInitialize and TestCleanup are ran before and after each test, this is to ensure that no tests are coupled. If you want to run methods before and after ALL tests, decorate relevant methods with the ClassInitialize and ClassCleanup attributes.
After some additional poking around the UI, I figured out a decent way to do this:
I'd still like a reasonable way to do this with only the keyboard, though!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With