7

We are building a setup that will send statistics information to the external server while building the application. There is the following build configuration with several steps.

  • 1st step builds the application and run unittests.
    • As a result a set of xml files (result of nUnit run) are created
  • 2nd step post a message Write-Host "##teamcity[importData type='nunit' path='%report.monitoring.rules%' parseOutOfDate='true' verbose='true']" to process them
  • 3rd step needs to access statistics information from the test run. Either through variables or REST api. For now it's requested using the following call Invoke-WebRequest -uri http://[host]/httpAuth/app/rest/builds/id:$buildId/statistics -Credential $creds -Headers @{"accept"="application/json"}

The problem is that inside the 3rd step I can't get statistics information even if pause is added. However, as soon as build is complete statistics appear (e.g. this line in the response <property name="TotalTestCount" value="2"/>)

The question: Is it possible to access information about test run during the build?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Maxim Nakhod
  • 106
  • 5

1 Answers1

0

Based on their documentation, it would appear as though you can get the information you want through issuing a request to a url like the following: http://teamcity:8111/app/rest/testOccurrences?locator=build:(id:XXX),currentlyFailing:true

peinearydevelopment
  • 11,042
  • 5
  • 48
  • 76
  • Thanks, it really returns information about test run even during the build time, however it's just part of statistical information we need. Is it possible to get code coverage information in the same way? I would even say, that I'm more interested in a way how to force TC to gather statistics earlier than the build finishes. So that I can get it in 1 request – Maxim Nakhod Apr 04 '17 at 07:59
  • Sorry, your question seemed to be specific to tests, which is why I answered that. The only other thought I have is: `Invoke-WebRequest -uri http://[host]/httpAuth/app/rest/buildsQueue -Credential $creds -Headers @{"accept"="application/json"}` [documentation](https://dploeger.github.io/teamcity-rest-api/#getBuild) – peinearydevelopment Apr 04 '17 at 13:10