How can I get the test history url via the REST api?

I am interested in getting or constructing this type of url:
http://localhost/project.html?projectId=TestConfig&testNameId=3332768445574407827&tab=testDetails
I think this is an example of what I am looking for:
https://confluence.jetbrains.com/display/TCD9/Working+with+Build+Results#WorkingwithBuildResults-TestHistory

test.id from below doesn't work when I use it as the testNameId parameter.

I am currently working with response from requests like:
http://localhost/guestAuth/app/rest/testOccurrences?locator=build:(id:1817)&fields=count,testOccurrence(id,status,duration,name,test(id))

My response looks like:

{
count28
testOccurrence
[
28]
0:  
{
id"id:1651,build:(id:1817)"
name"ConvertPackages"
status"SUCCESS"
duration46110
test
{
id-7968562788434831000
}
-
}
-
1:  
{
id"id:1653,build:(id:1817)"
name"Generate"
status"SUCCESS"
duration59111
test
{
id7040987498533861000
}
-
}


Thanks.

5 comments
Comment actions Permalink

Hi,

You can use the following request to get the test history:
http://teamcity:8111/app/rest/testOccurrences?locator=test:9191830574228186038
to get the information about individaul test, where 9191830574228186038 is available as a part of the URL on the test history page. Is it what you need? If not, then please provide more details.

0
Comment actions Permalink

Sorry, that's not what I am looking for.
What I am looking for is most like webUrl from this request:
/guestAuth/app/rest/builds/?locator=buildType:TestConfig,number:123,&fields=count,build(id,startDate,status,statusText,number,webUrl)

I am looking for a url to a page like:
https://confluence.jetbrains.com/download/attachments/54334628/TestHistory.png

0
Comment actions Permalink

Thank you for provided details.
However the test id from the following request http://localhost/guestAuth/app/rest/testOccurrences?locator=build:(id:1817)&fields=count,testOccurrence(id,status,duration,name,test(id)) should work in the URL.
Please check that you use the correct projectId.


For example, http://teamcity:8111/app/rest/testOccurrences?locator=test:9191830574228186038 returns:

<testOccurrences count="1" href="http://teamcity:8111/app/rest/testOccurrences?locator=test:9191830574228186038">
<testOccurrence id="build:(id:1523166),id:606" name="testName" status="SUCCESS"duration="82882" href="/app/rest/testOccurrences/build:(id:1523166),id:606"/>
</testOccurrences>


http://
teamcity:8111/app/rest/testOccurrences?locator=build:(id:1523166)&fields=count,testOccurrence(id,status,duration,name,test(id)) returns:

...
<testOccurrence id="build:(id:1523166),id:606" name="jetbrains.buildServer.vcs.clearcase.junit.test.customdata.CCChangesWithCacheTest.testAddFile_DevStream" status="SUCCESS"duration="82882">
<test id="9191830574228186038"/>
</testOccurrence>
...


The working URL for the build history is: http://teamcity:8111/project.html?projectId=TC_Plugins&testNameId=9191830574228186038&tab=testDetails

0
Comment actions Permalink

Oh you're right. I didn't test all the test ids. But out of my 28 tests and their ids, only 9 ids worked when put into this url type:
http://localhost/project.html?projectId=TestConfig&testNameId=3332768445574407827&tab=testDetails

I found the cause of this issue. I am requesting json results, and "In JavaScript, one has at most 53 bits for integers." (found here http://www.2ality.com/2012/07/large-integers.html).
So a test id that is -7968562788434831265 become -7968562788434831000.

Can you please change the api to return test id as string?
Thank you.

0
Comment actions Permalink

Thank you for the report. I created the issue https://youtrack.jetbrains.com/issue/TW-42028, please watch/vote for it.
Sorry for the inconvenience.

0

Please sign in to leave a comment.