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.
self._tc_messages.message('testMetadata',
testName=test_name,
name='RAM usage mean (MB)',
type='number',
value='{:.2f}'.format(stats.mean_mem))
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
https://teamcity.XXXXX.com//app/rest/testOccurrences?locator=test:(id:-2942483353318573815)
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"/>
Please sign in to leave a comment.
The request was solved in Zendesk; for general availability, specific metadata value may be retrieved with the following call: