How to read TeamCity build statistic in build steps?
We are using Teamcity to run Maestro automation tests. Maestro outputs a JUnit report after running tests, which we import using TeamCity XML Report Processing. We also send a slack notification using a command line build step, and want to include test count (passed/failed/total) in the message. Is there a way to read the test statistics from TeamCity inside a build step? Or perhaps in a Composite build that is dependent on the test build?
Please sign in to leave a comment.
Hi!
Perhaps using the REST API would be an option for you?
https://www.jetbrains.com/help/teamcity/rest/get-build-statistics.html#Get+Build+Statistic+Values
As an example, you could a call:
And the result would be something like this:
Hi, thanks for sharing this! We could try to implement this as a pull model.
But isn't it possible to read build statistics in a build step? It would help us implement a push model, where we can send the data at end of build, rather than a pull model which would have to continuously poll TC.
As far as I am aware, using the REST API would be the recommended way to do this.