Will Custode
Will Custode

Reputation: 4604

Running Automated Tests with Multiple Categories

I have a suite of tests that are run using MSTest from Visual Studio 2015 Community Edition. Each test has several categories on it and I'm trying to figure out how to run a subset of all tests by selecting multiple categories.

Currently, I am viewing all of my tests using the Test Explorer window in VS. From there, I right-click and select Group By > Traits. Then I can run any single grouping of tests, but I can't figure out how to run a cross-section of two or more traits.

As an example, I have integration tests, API tests, and unit tests for both my services and repositories. I'm trying to figure out how to run all repository integration tests at once, or all service unit tests.

I've read that I can do this (fairly simply) through the command line, but I'm wondering if this functionality exists through Visual Studio (maybe via an extension?) or some other free application.

Upvotes: 2

Views: 810

Answers (1)

John Koerner
John Koerner

Reputation: 38077

In the Test Explorer search box, you can specify traits and they are anded together. So for your example of repository integration tests, you would specify the string:

Trait:"Repository" Trait:"Integration"

enter image description here

This will filter the view to only those tests and then you can run all of the tests that match that filter.

Upvotes: 3

Related Questions