Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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

0 votes

Comments

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

1 vote

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

 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

0 votes

Comments

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


 

1 vote

@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

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

1 vote

Comments
@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 log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Mar 21 '22, 2:44 a.m.

Question was seen: 2,350 times

Last updated: Mar 23 '22, 7:26 a.m.

Confirmation Cancel Confirm