TeamCity 2021.1 Help

Manage Tests and Build Problems

This article lists REST API requests concerning tests and build problems.

List Build Problems

To list build problems, use:

GET http://<TeamCity Server host>:<port>/app/rest/problemOccurrences?locator=<problemOccurrenceLocator>

The request responds with Problems which contains instances of a Problem entity.

problemOccurrenceLocator is typed as ProblemOccurrenceLocator. For example, to get build problems for a build with the ID 999, use:

GET http://<TeamCity Server host>:<port>/app/rest/problemOccurrences?locator=build:(id:999)

List Tests

To list specific tests, use:

GET http://<TeamCity Server host>:<port>/app/rest/testOccurrences?locator=<testOccurrenceLocator>

The request responds with Tests which contains instances of a Test entity.

testOccurrenceLocator is typed as TestOccurrenceLocator.

Some supported locator dimensions:

  • build:(<buildLocator>) — test run in the build found with buildLocator (BuildLocator).

  • build:(<buildLocator>),muted:true — failed tests which were muted in the build.

  • test:(<testLocator>) — instances of the test found with testLocator (TestLocator).

  • currentlyFailing:true,affectedProject:<projectLocator> — tests currently failing under the project specified with projectLocator (recursively). projectLocator is typed as ProjectLocator.

  • currentlyMuted:true,affectedProject:<projectLocator> — tests currently muted under the project specified (recursively). See also the project's Muted Problems tab.

  • includePersonal:true — include tests from personal builds.

For example, to list all tests for a given build with the ID 999 use:

GET http://<TeamCity Server host>:<port>/app/rest/testOccurrences?locator=build:(id:999)

To get the test history for a given test named MyTest, use:

GET http://<TeamCity Server host>:<port>/app/rest/testOccurrences?locator=test:(name:MyTest)

To list a build's tests which were muted during the build run, use:

GET http://<TeamCity Server host>:<port>/app/rest/testOccurrences?locator=build:(id:999),muted:true

To list currently muted tests (muted since the failure), use:

GET http://<TeamCity Server host>:<port>/app/rest/testOccurrences?locator=build:(id:999),currentlyMuted:true

List All Muted Tests and Build Problems

To retrieve a list of all muted entities, use:

GET http://<TeamCity Server host>:<port>/app/rest/mutes

The request responds with Mutes which contains instances of a Mute entity.

To get specific mutes, use:

GET http://<TeamCity Server host>:<port>/app/rest/mutes/<muteLocator>

muteLocator is typed as MuteLocator. For example, to locate all muted tests under the MyProject project, use:

GET http://<TeamCity Server host>:<port>/app/rest/mutes/project:(id:MyProject)

Mute Test and Build Problems

To mute a given test or a build problem, POST a Mute to:

POST http://<TeamCity Server host>:<port>/app/rest/mutes

Example payload:

<mute> <scope><project id="<projectID>"/></scope> <target><tests><test name="<testName>"/></tests></target> <resolution type="whenFixed"/> </mute>
{ "scope" : { "project" : { "id" : "id" } }, "target" : { "tests" : { "test" : [ { "name" : "name" } ] }, }, "resolution" : { "type" : "whenFixed" } }

Unmute Test/Build Problem

To unmute a test or build problem, use:

DELETE http://<TeamCity Server host>:<port>/app/rest/mutes/<muteLocator>
Last modified: 14 October 2021