Defining Test Categories to Group Your Tests
If you have created automated tests using Visual Studio you can manage these tests by categorizing them with test categories. When you run these automated tests using Visual Studio, Team Foundation Build, or mstest.exe, you can use these test categories to easily select which tests you run. You add test categories as attributes to your test methods.
- Visual Studio Enterprise, Visual Studio Test Professional
Test categories provide more flexibility than the test lists functionality from earlier versions of Microsoft Visual Studio. You can use logical operators with test categories to run tests from multiple categories together or to limit the tests that you run to tests that belong to multiple categories. Also test categories are easy to add as you create your test methods and you do not have to maintain test lists after you have created your test methods. By using test categories, you do not have to check in and check out the <solution name>.vsmdi file that maintains the test lists.
|Grouping Tests into Test Categories: You can add an automated test to one or multiple test categories using a test attribute. Each test can belong to multiple test categories.||- How to: Group and Run Automated Tests Using Test Categories|
|Running Tests Using Test Categories: After you choose which tests you want to run, you can choose which test categories they must belong to. You do this by using logical operators. For example, you could run all tests that belong to Priority 1 test category and Priority 2 test category.||- VSTest.Console.exe command-line options|
- MSTest.exe command-line options
|Using Test Categories To Select Tests to Run Before Check-In: You can use a build to check your code changes before you check in. You can use test categories to define the tests to run for this gated check-in build.||- Use gated check-in to validate changes|
|Using Test Categories To Select Tests to Run After Building Your Application or Before Check-In: You can use a build definition to define which test categories to run to test a new build.||- How to: Configure and Run Scheduled Tests After Building Your Application|