Manage Tests and Build Problems
This article lists REST API requests concerning tests and build problems.
List build problems |
GET http://<TeamCity URL>:<port>/app/rest/problemOccurrences?locator=build:(BUILD_LOCATOR)
|
List tests |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=<locator dimension>:<value>
|
Supported locators:
build:(<build locator>)
– test run in the build.build:(<build locator>),muted:true
– failed tests which were muted in the build.currentlyFailing:true,affectedProject:<project_locator>
– tests currently failing under the project specified (recursively).currentlyMuted:true,affectedProject:<project_locator>
– tests currently muted under the project specified (recursively). See also the project's Muted Problems tab.includePersonal:true
- include tests from personal builds.
Examples:
List all build's tests |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=build:<buildLocator>
|
Get individual test history |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=test:<testLocator>
|
List build's tests which were muted when the build ran |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=build:(id:XXX),muted:true
|
List currently muted tests (muted since the failure) |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=build:(id:XXX),currentlyMuted:true
|
Supported test locators:
id:<internal test id>
available as a part of the URL on the Test History pagename:<full test name>
There is an experimental support for exposing single test invocations / runs:
Get invocations of a test |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=build:(id:XXX),test:(id:XXX)&fields=$long,testOccurrence($short,invocations($long))
|
List all test runs with all the invocations flattened |
GET http://<TeamCity URL>:<port>/app/rest/testOccurrences?locator=build:(id:XXX),test:(id:XXX),expandInvocations:true
|
Muted Tests and Build Problems
Since TeamCity 2017.2
List all muted tests and build problems |
GET http://<TeamCity URL>:<port>/app/rest/mutes
|
Unmute a test or build problems |
DELETE http://<TeamCity URL>:<port>1/app/rest/mutes/id:XXXX
|
Mute a test or build problems |
POST http://<TeamCity URL>:<port>/app/rest/mutes
Use the same XML or JSON as returned by Example of XML for muting a test:
<mute>
<scope><project id="<projectID>"/></scope>
<target><tests><test name="<testName>"/></tests></target>
<resolution type="whenFixed"/>
</mute>
|