测试结果团队城市的历史

时间:2016-03-09 18:52:29

标签: api testing teamcity

我希望通过调用其他apis来获取teamcity的测试运行历史记录。

到目前为止,我发现:

 http://teamcity.xyz.com/app/rest/builds/65602/statistics

但这只会给出一次跑步的统计数据。

我在Teamcity api文档中找到了以下内容,但我不清楚应该在哪里输入多个构建号

  http://teamcity:8111/httpAuth/app/rest/builds?locator=BUILDS_LOCATOR&fields=build(id,number,status,buildType(id,name,projectName),statistics(property(name,value)))

有没有人试过这个?

1 个答案:

答案 0 :(得分:0)

您可以使用 buildTypes 端点通过不同的途径实现此目的,因为定位器仅支持单个ID维度。

e.g。

/httpAuth/app/rest/buildTypes/id:##BUILD_TYPE##/builds?fields=build(id,number,status,buildType(id,name,projectName),statistics(property(name,value)))

这将返回类似于以下内容的数据

<builds>
  <build id="185" number="1.0.0.2" status="SUCCESS">
    <buildType id="Website_1BuildApplication" name="1 - Build Application" projectName="Website"/>
    <statistics>
      <property name="ArtifactsSize" value="4201093"/>
      <property name="BuildArtifactsPublishingTime" value="921"/>
      <property name="BuildCheckoutTime" value="377"/>
      <property name="BuildDuration" value="21791"/>
      <property name="BuildDurationNetTime" value="20493"/>
      <property name="buildStageDuration:artifactsPublishing" value="952"/>
      <property name="buildStageDuration:buildFinishing" value="15"/>
      <property name="buildStageDuration:buildStepRUNNER_6" value="19313"/>
      <property name="buildStageDuration:firstStepPreparation" value="219"/>
      <property name="buildStageDuration:sourcesUpdate" value="496"/>
      <property name="BuildTestStatus" value="1"/>
      <property name="SuccessRate" value="1"/>
      <property name="TimeSpentInQueue" value="6272"/>
    </statistics>
  </build>
  <build id="183" number="1.0.0.1" status="SUCCESS">
    <buildType id="Website_1BuildApplication" name="1 - Build Application" projectName="Website"/>
     <statistics>
       <property name="ArtifactsSize" value="4200811"/>
       <property name="BuildArtifactsPublishingTime" value="297"/>
       <property name="BuildCheckoutTime" value="19500"/>
       <property name="BuildDuration" value="45123"/>
       <property name="BuildDurationNetTime" value="25326"/>
       <property name="buildStageDuration:artifactsPublishing" value="328"/>
       <property name="buildStageDuration:buildFinishing" value="140"/>
       <property name="buildStageDuration:buildStepRUNNER_6" value="23603"/>
       <property name="buildStageDuration:firstStepPreparation" value="265"/>
       <property name="buildStageDuration:sourcesUpdate" value="19516"/>
       <property name="BuildTestStatus" value="1"/>
       <property name="SuccessRate" value="1"/>
       <property name="TimeSpentInQueue" value="234"/>
     </statistics>
   </build>
</builds>

希望这有帮助