rest api - current build information update

What is the best way to get the statusText information via rest api from the currently running build's build script?

Especially, I want to get this info right after i imported the test results by echoing a standard ##teamcity['importData', 'mstest', '/path/to/trx'] thing. However, the statusText is of the build is not updated immediately, there is a delay (which is normal, teamcity server must process a lot of things).

I can do a 5 sec sleep between the test data import and the rest api call, which works, but it is unstable under heavy load.
Instead currently I am doing the following: query the statusText once, then in a loop I am calling it again until the statusText changes or a timeout elapses (if for some reason I have the right statustext for the very first call).

Is there a better way for this? The whole reason is that I don't want to parse test logs since teamcity did the job already and it has the info I need in that statusText ;)

Can we expect some new rest api features in the future that allows us querying test results?

Please sign in to leave a comment.