TeamCity test metadata query using Rest API.


I am reporting custom test metadata like CPU usage , RAM usage to the TC along with test duration that can be viewed from the test history page.
name='RAM usage mean (MB)',
I am planning to make use of this historical data and mark the test case as fail if the CPU usage is > 20% of the historical data.
For example, to fetch the test duration, I am using the following query
which will give the following response, and then I am parsing this response to calculate the average test duration.
But the response is not returning the custom metadata(CPU and RAM) that I report to TC.

Is there a way where I can query the custom meta data(CPU and RAM usage) that was reported by my test framework to TC like for Test duration?

<testOccurrence id="build:(id:264672),id:48486" name="XXXX" status="SUCCESS" duration="61103" href="/app/rest/testOccurrences/build:(id:264672),id:48486"/>
<testOccurrence id="build:(id:264676),id:12225" name="XXXX" status="SUCCESS" duration="67452" href="/app/rest/testOccurrences/build:(id:264676),id:12225"/>
<testOccurrence id="build:(id:264662),id:46439" name="XXXX" status="SUCCESS" duration="64100" href="/app/rest/testOccurrences/build:(id:264662),id:46439"/>
<testOccurrence id="build:(id:264666),id:10282" name="XXXX" status="SUCCESS" duration="94581" href="/app/rest/testOccurrences/build:(id:264666),id:10282"/>


1 comment
Comment actions Permalink

The request was solved in Zendesk; for general availability, specific metadata value may be retrieved with the following call:

[GET] <TeamCity URL>/app/rest/testOccurrences?locator=build:<build ID>&fields=testOccurrence(metadata(typedValue,$locator(name(<metadata value name here>))))



Please sign in to leave a comment.