How to create a TCER for a testcase using REST API?
Hello everyone I tried to create a TCER by doing the following steps based on the documentation.
1. POST request : https://hostname/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project-URI>/executionworkitem
2. Add the following TCER XML structure:
<ns2:executionworkitem xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns1="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns6="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns7="http://purl.org/dc/terms/" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns13="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns14="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/" xmlns:ns17="http://www.w3.org/1999/XSL/Transform">
...
<ns2:title href="TC_Template"/>
<ns2:executionworkitem xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns1="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns6="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns7="http://purl.org/dc/terms/" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns13="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns14="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/" xmlns:ns17="http://www.w3.org/1999/XSL/Transform">
...
<ns2:title href="TC_Template"/>
<ns2:testcase href="https://hostname/qmA1/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECT-URI/testcase/urn:com.ibm.rqm:testcase:282962"/>
...
</ns2:executionworkitem>
...
</ns2:executionworkitem>
3. The response received is this
<ns2:statusCode>400</ns2:statusCode>
<ns2:message>AQXEX5062E The test case execution record "TC_Template" cannot be created because the referenced test case does not exist on the server.</ns2:message>
<ns2:statusCode>400</ns2:statusCode>
<ns2:message>AQXEX5062E The test case execution record "TC_Template" cannot be created because the referenced test case does not exist on the server.</ns2:message>
What I do wrong here? I'm cannot figure it out. The URLs for the testcases, testplan are correct.
3 answers
There are basically two CRUD APIs for ETM. See https://jazz.net/wiki/bin/view/Deployment/ELMProductAPILanding look into the ETM section and note the Reportable REST API. There is also an OSLC QM API. Ask an AI for the documentation.
The Reportable REST API is a bit simpler.
For the Reportable REST API you need to query for the items, you want to assign. See the link above and have a look.
I find the OSLC API more heavyweight, but it works. Follow the specification. The special thing with OSLC is the discovery process. https://rsjazz.wordpress.com/2022/02/22/ewm-oslc-query-api/ provides a hint how to use OSLC for querying. It is a different domain, but the mechanisms work the same.
Otherwise follow Ian. You need special headers for OSLC and you have to provide the configuration URI in case you have Configuration management enabled. The APIS are different, but the configuration-context headers are the same for both.
I should also mention the X-Jazz-CSRF-Prevent header that needs to set to the value of the JSESSIONID cookie for PUT and POST operation. You can get the JSESSIONID with a get Operation. There is the E-TAG Header and the if-Match Header that should be used. I also once ran into an issue, where I had to put an arbitrary User-Agent header with an arbitrary value, otherwise the POST would always fail. This was dependent on the default value of the user-value agent.
Last but not least, be sure you are authenticated. The Location header should not show "Authentication Required" or something like that. It would show the OSLC URI if the operation succeeded. In the Reportable REST API you get a slug to be able to retrieve the item, if successfully created. See the documentation.
Is a Reportable REEST API if at all at best. Not sure it does not look like:
Reportable RESTDocumentation: https://jazz.net/wiki/bin/view/Main/RqmApi does not look like https://<host>:<port>/ <contextRoot>/service/com.ibm.rqm.integration.service.IIntegrationService which is the root for the Reportable REST API entrypoint for queries.
Comments
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 08, 4:03 a.m.Paraschivoiu Alexandru
Apr 08, 4:22 a.m.Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 08, 10:28 a.m.Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 08, 10:32 a.m.Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 08, 12:32 p.m.