It's all about the answers!

Ask a question

How to create Test Case Execution Records and Test Case Execution Workitems via REST API?


Stefan Schroeder (113) | asked Feb 08 '16, 4:40 a.m.
Hi,

I am trying to create Test Case Execution Records and Test Case Execution Workitems via REST API.

I can already download testplans, testcases, testscripts, executionrecords and executionworkitems,
and I can upload the XML files, that I downloaded.

But I am unable to create new TCER from scratch with a generated ID.

https://jazz.net/wiki/bin/view/Main/RqmApi#Create

does not help. It gives no indication what exactly to send. The tip from

https://sleroyblog.wordpress.com/2013/04/09/querying-rqm-40-through-oslc-and-rest-api/

    Create a Test Case Execution Results (ext  ID “myChosenID”)
    Other things to keep in mind:
        If providing an external ID, you should make sure your PUT does NOT contain any /urn:com.ibm.rqm:xxxxxx content (this is reserved for GUI created test artifacts).

does not work. The server responds with "The uploaded file is not properly formatted XML", although there is no file to be uploaded in the first place, I am trying to generate one from scratch.

On the web-interface I can create Executionresults and TCER, but the two documents reference each other (via href). How would I patch existing XML files with yet to be created WebId's for upload?

How do I create a blank TCER and/or execution workitem, that I then can download and fill in?

Can somebody please provide an example HTTP-request for

either

(a) creating an empty executionresult and executionworkitem.
or
(b) a minimal dummy executionresult-XML and executionworkitem-XML to upload it to create a new executionresult and executionworkitem.

I feel that once there is one in the system with a proper ID, I can update it by downloading it and
re-uploading it.

An example with "poster" would also be fine; but Excel/Word are not ok (we're not on Windows)

Kind regards
Stefan Schröder
- Germany
RQM Application 5.0.2
Rational Jazz Team Server Version: 5.0.2

One answer



permanent link
Paul Slauenwhite (8.3k12) | answered Feb 08 '16, 7:21 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Stefan,

A test case execution result requires a test case execution record.  However, you can create a test case execution record from the RQM UI without a test case execution result. 

When learning how to create new test resources using the RQM Reportable REST API , follow https://jazz.net/wiki/bin/view/Main/RqmApi#ScenarioCreateTip.  Note, use the RQM XML schema documentation (https://jazz.net/wiki/bin/view/Main/RqmApi#Detailed_Schema_Documentation) to determine the required/optional/read-only properties of the test resources.

Comments
Stefan Schroeder commented Feb 08 '16, 7:29 a.m.

Ok, thank you. Paul, for the quick response. I will investigate the resources that you mentioned. Am I reading your response correctly, that it is always required to upload a fully compliant (according to the xsd) item, even when creating one from scratch?


Paul Slauenwhite commented Feb 08 '16, 7:47 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Yes.  To be compliant, all required (writable) properties must be set.


Stefan Schroeder commented Feb 09 '16, 8:49 a.m.

Hi Paul,

now with this new knowledge I want to create a new test case execution record (which is also called a executionworkitem). When I leave out the webId in the XML, I am getting the error response:

A resource of type executionworkitem with missing ID cannot be created.

(My own translation from the German error message, the original English version might differ a little). But Stephane Leroy says in his blog post (mentioned above):

"If you don’t provide an external ID (like in the “Create a Test Case” sample above), RQM will auto generate one. It shall be returned in the  response header “Content-Location“."

This comment was AFAICT referring to the URL of the HTTP Post request, but not to the content of the XML. When I try to lookup the XSD of the execution workitem, the associated namespace (http://jazz.net/xmlns/alm/qm/v0.1/) yields a 404.

I am again running out of ideas. Where do I lookup the XSD for the webID-tag?


Paul Slauenwhite commented Feb 09 '16, 10:25 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

PUT requests require an ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#PUT_requests).  It's not the webId property of the resource, but the ID segment of the request URL.

Can you open https://jazz.net/products/rational-quality-manager/api-doc-5.0.2/schemas/qm_xsd/elements/executionworkitem.html?


Stefan Schroeder commented Feb 09 '16, 10:55 a.m.

Hi Paul,

I got it to work! I don't yet know how exactly, but one of my two-digit attempts to upload succeeded. I just didn't notice, because I did not receive an XML as response as I expected, but the TCER of my local file showed up, like, 50 minutes ago. One of my attempts must have been successful :-D

Now I only have to trace back which one... One hint for the record: I helps to dump the Response-Header and look out for the Content-Location field.

And: Yes, I can see that link. In that document, webId is listed as READONLY. The Min-Occurs=0 indicates that it is optional if my XSD knowledge does not fail me.


Your answer


Register or to post your answer.