Unable to get test case and build stats through rest API call

For our functional tests we are using below rest api queries for retrieving statistical data.

Get single build statistics value: GET  http://teamcity:8111/app/rest/builds/<buildLocator>/statistics/<value_name>

Get statistics for a list of builds: GET http://teamcity:8111/app/rest/builds?locator=BUILDS_LOCATOR&fields=build(id,number,status,buildType(id,name,projectName),statistics(property(name,value)))

It is giving us below set of data :

<statistics>

<property name="artifactResolving:averageSpeed:HTTP transport" value="1382222"/>
<property name="artifactResolving:totalDownloaded:HTTP transport" value="152590448"/>
<property name="ArtifactsSize" value="171887349"/>
<property name="BuildDuration" value="787683"/>
<property name="BuildDurationNetTime" value="652518"/>
<property name="buildStageDuration:artifactsPublishing" value="15482"/>
<property name="buildStageDuration:buildFinishing" value="13"/>
<property name="buildStageDuration:buildStepRUNNER_3678" value="23556"/>
<property name="buildStageDuration:buildStepRUNNER_3679" value="41134"/>
<property name="buildStageDuration:buildStepRUNNER_4645" value="587828"/>
<property name="buildStageDuration:dependenciesResolving" value="119482"/>
<property name="buildStageDuration:firstStepPreparation" value="1"/>
<property name="BuildTestStatus" value="1"/>
<property name="SuccessRate" value="1"/>
<property name="TimeSpentInQueue" value="137"/>
<property name="VisibleArtifactsSize" value="171080665"/>

</statistics>

However, we need below stats for our analyze:

1. Test case count - failed, passed,ignored and  total test cases executed for a build

2. Also do not give option to sort builds by date. e.g if we want to know total no. of builds executed on particular date.

 

Can anyone help us how we can retrieve this required data?

0
1 comment

Hi,

 

1- tests aren't considered statistics, and are presented separately: https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-BuildproblemsTestsTestsandBuildproblems

 

2- The build locator has a date parameter: https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-BuildLocator (See "startDate/finishDate" with the "before"/"after"  option)

 

Those two should give you access to the information you are looking for.

0

Please sign in to leave a comment.