TeamCity 7.x Rest API & Enhanced Build Statistics

We’ve been in touch with one of your colleagues about the following requirements – we want to be able to retrieve the internal statistics of each test method successes, duration, failures, logs etc etc as far as possible. Teamcity does store this but doesn’t make it available via REST api. Your colleague advises to write a TeamCity addon.

I am writing directly to you as you have updated last the Teamcity’s API docs.

Questions:

1.       Would it be possible to extend the REST API to satisfy our requirements? I am confident that all your clients would benefit from such an extension as the present API is rather restrictive.

2.       Can you share with me any code for a TeamCity addon doing the above for our inspiration? Would it be possible to share the NUnit Runner code so that we would extend it to meet our goals?

1 comment
Comment actions Permalink

> 1.       Would it be possible  to extend the REST API to satisfy our requirements? I am confident that  all your clients would benefit from such an extension as the present API  is rather restrictive.

It should be possible and I filed a feature request on that. However, I am not sure we will be able to deliver that improvement in one of the nearest releases.
In the mean time the workaround is to list all the builds via REST and get tests from them in .csv format (via URL available from buld's Tests tab).

> 2.       Can  you share with me any code for a TeamCity addon doing the above for our  inspiration?

We do not have any example code to share at this time.

If you want to write a Java plugin for TeamCity it would be possible via closed API (read "can change in future versions of TeamCity without any notice"), that can look something like:

BuildHistoryEx buildHistory; //obtained via Spring

buildHistory.getTestHistory(TestName2Index.getInstance().getOrSaveTestNameId(testName), buildTypeId, userId)

> Would it be possible to share the NUnit Runner code so  that we would extend it to meet our goals?

Unfortunately, no. We have parts of TeamCity codebase open-sourced, but NUnit tests runner is not part of that.

Also, NUnit tests runner does not seem to be related to the task of getting test runs in a propery architectured plugin.

In addition, if it is OK to get all the tests of a build, then you can perfectly use the approach outlined to question 1.

0

Please sign in to leave a comment.