Search code examples
tfsxunittfs-2015

Run/Exclude Specific Tests in Build Definition Team Foundation Server 2015


In one of our build definitions I'm trying to configure a 'Visual Studio Test' build step to run a specific set of tests.

There is a 'Test Filter critera' box (below) but this doesn't seem to have any effect, running all tests regardless. It's not like the search filter box in Test Explorer in VS2015, and there are some references to a 'TestCaseFilter' but this doesn't apply here (and might be TFS2012 only).

TFS build definition Visual Studio Test configuration

Can this be used to actually filter tests, or should I be doing it some other way (e.g. provide a settings file?)

FWIW we're using Xunit for our unit tests.


Solution

  • Test Filter Criteria filters tests from within the test assembly files. This option works the same way as the console option /TestCaseFilter of vstest.console.exe, you can test with vstest.console.exe command line to see whether it works.

    As an alternate, you can specify the tests in Test Assembly. This field specifies the test assemblies(s) from which the tests should be picked.

    • Wildcards can be used
    • Multiple paths can be specified separated by a semicolon
    • Paths are relative to the Sources Directory