TeamCity 4.0 Help

Running Risk Group Tests First

This section covers:

Reordering Risk Tests for JUnit and TestNG

Supported environments:

  • Ant and IPR runners

  • JUnit and TestNG frameworks when tests are started with usual JUnit or TestNG tasks

You can instruct TeamCity to run some tests before others. You can do this on the build runner settings page. Currently there are two groups of tests that TeamCity can run first:

  • recently failed tests, i.e. the tests failed in previous finished or running builds as well as tests having high failure rate (a so called blinking tests)

  • new and modified tests, i.e. tests added or modified in changelists included in the running build

TeamCity allows you to enable both of these groups or each one separately.

Tests reordering works the following way:

  1. TeamCity provides tests that should be run first (test classes).

  2. When a JUnit task starts, TeamCity checks whether it includes these tests.

  3. If at least one test is included, TeamCity generates a new fileset containing included tests only and processes it before all other filesets. It also patches other filesets to exclude tests added to the automatically generated fileset.

  4. After that JUnit starts and runs as usual.

TeamCity operates on test case basis, that is not the individual tests are reordered, but the full test cases. The tests cases are reordered only within a single test execution Ant task, so to maximize the feature effect, use a single test execution task per build.

testReorderingForNUnitReordering Risk Tests for NUnit

Supported build runners:

Tests reordering only supports reordering of recently failed tests

If risk tests reordering option is enabled, the feature for NUnit test runner works in the following way:

  1. NUnit runs tests from the "risk" group using test name filter.

  2. NUnit runs all other tests using inverse filter.

Last modified: 20 April 2023