It's all about the answers!

Ask a question

How to create test result via reportable REST Api /oslc api in ETM


Rajat Krishnan (709) | asked Mar 21 '22, 2:44 a.m.
Hello,
I am currently working on automating the complete RQM/ETM Test case execution model using reportable rest api /oslc api but till date i was just using GET command and things were bit easy to understand :) but now i am finding some trouble while using PUT command , i read somewhere in blog that we use PUT command for test artifacts and POST for attachment (please correct me)

Now coming to part What i need? :
My input :
-> TCER ID
-> Test Case ID
-> Test Plan ID
-> Test Verdict(passed, failed ,...)
-> Start time
-> End time
-> Artifactory Link that could be linked in test result somewhere

Now i need the rest uri to create test result and link tcer,test case, test plan and update verdict and time , is it possible ?
I know how to update value using PUT command but how to create test result i am not sure, can anyone help me out

Thank you


Comments
1
Brian Lahaie commented Mar 22 '22, 2:18 a.m.

Its definitely possible to create a test case result using the REST APIs. I will add an answer below.


Rajat Krishnan commented Mar 22 '22, 2:46 a.m.
Hello @Brian Lahaie,
Thanks for addressing my query.
Right now i am following below approach not sure its optimal approach or not

-> Using GET Command i am getting xml schema of existing test result
-> Modifying xml schema based on my need and forming a new schema
-> Using PUT command i am creating new test result

I am doing all this using RQMUrlUtility
Here is put command using which i am achieving the usecase

Also you mentioned you some solution ,could you please share that
Thank you

Accepted answer


permanent link
Brian Lahaie (1081514) | answered Mar 22 '22, 2:58 a.m.

 First do a GET on an existing test case result to get an example of the XML which is needed to create a new test case result.

Here is what I did, headers:
Accept: text/xml
Content-Type: application/xml

Next I copied the XML from the response into Notepad and removed the following:
<ns2:creationDate>2021-09-14T17:23:47.942Z</ns2:creationDate>
<ns6:updated>2021-09-14T17:27:11.234Z</ns6:updated>
<ns16:starttime>2021-09-14T17:23:47.942Z</ns16:starttime>
<ns16:endtime>2021-09-14T17:27:11.203Z</ns16:endtime>
<ns16:totalRunTime>204000</ns16:totalRunTime>
<ns16:actualRunTime>203261</ns16:actualRunTime>
<ns2:alias type="string">urn:com.ibm.rqm:executionresult:11</ns2:alias>

I then used the remaining XML to PUT the result on the server.
Here is what I did, headers:
Accept: text/xml
Content-Type: application/xml

Note, the last part of the URI needs to be unique, e.g. 20220321_1150PM.  This is the External ID.  In the documentation provided by Ralph it defines the external ID as the following:
A unique ID provided by the user when creating a new resource with a PUT. Resources created in the Rational Quality Manager UI will not have external IDs. An external ID can contain any characters allowed in a URI (URI-reserved characters (see RFC 2396) except the '/' character MUST be URL encoded in GET/PUT requests) and should NEVER contain urn:com.ibm.rqm: <resource type>: (internal ID). 

Rajat Krishnan selected this answer as the correct answer

Comments
1
Ralph Schoon commented Mar 22 '22, 3:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It is possible to use POST instead of PUT, in which case the ID gets created for you.


 


Rajat Krishnan commented Mar 23 '22, 7:26 a.m.
@Ralph Schoon,
Which means if i use POST then i don't need to worry unique ID mentioned in Brian post, Excellent thanks!!



One other answer



permanent link
Ralph Schoon (62.3k33643) | answered Mar 21 '22, 3:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Here is the documentation https://jazz.net/wiki/bin/view/Main/RqmApi#Usage_Basics hinting that you would do a POST to create items.


Comments
Rajat Krishnan commented Mar 22 '22, 2:47 a.m.
@Ralph Schoon,
Thanks for sharing this info link , i have done some tryouts not sure whether its optimal approach or not but some expert advice is surely required here :)

Thank you

Your answer


Register or to post your answer.