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

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

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

0 votes



3 answers

Permanent link
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.

0 votes

Comments

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?

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

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?

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?

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.



Permanent link

Hello Stefan ,

Can you tell me what xml file you used to create TCR from and existing TER id ?

0 votes


Permanent link

 What have you done/tried already? 


I use curl for the http-interaction with the RQM-server. I use bash shell scripts as glue-code. I use XML templates for providing the results and I use Perl scripts to fill in the desired values in my XML templates. 

It all works now, but it's not trivial. It all starts with a plan. I download the plan in XML: I extract the test-script IDs from the plan. I download the test-scripts, etc. and on it goes. If you ask a more specific question, I can help you more efficiently. 

Environment is cygwin in Windows, but should also work for Linux.

0 votes

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
× 12,120

Question asked: Feb 08 '16, 4:40 a.m.

Question was seen: 6,634 times

Last updated: Apr 01 '20, 12:25 p.m.

Confirmation Cancel Confirm