RQM REST API: How to link newly created test cases to existing test plan
Hello everyone.
I have used the REST API to create a bunch of test cases in RQM, using an HTTP PUT request. I do get 201 responses back for every test case created, which means that the requests suceed - I can also view the test cases in RQM's web UI.
The problem comes when I am trying to link those test cases to an existing test plan. I have the test plan identifier (doublechecked to be a valid one), and I encapsulate the test case identifiers into an HTTP PUT request like so:
https://jazz.net/wiki/bin/view/Main/RqmApi#Update
However, I cannot see the test cases linked inside the test plan from the Web UI. Is there something I am missing ?
I have used the REST API to create a bunch of test cases in RQM, using an HTTP PUT request. I do get 201 responses back for every test case created, which means that the requests suceed - I can also view the test cases in RQM's web UI.
The problem comes when I am trying to link those test cases to an existing test plan. I have the test plan identifier (doublechecked to be a valid one), and I encapsulate the test case identifiers into an HTTP PUT request like so:
<ns2:testplan xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns="http://purl.org/dc/elements/1.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns3="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns4="http://schema.ibm.com/vega/2008/" xmlns:ns5="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns8="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1"> <identifier xmlns="http://purl.org/dc/elements/1.1/">https://almdev.cl.internal.ericsson.com:443/qm/secure/service/com.ibm.rqm.integration.service.IIntegrationService/resources/DUCI_AXE_IV_PMT/testplan/urn%3acom.ibm.rqm%3atestplan%3a181</identifier> <title xmlns="http://purl.org/dc/elements/1.1/">Testing MBT</title> <description xmlns="http://purl.org/dc/elements/1.1/">Automatically generated from RQM Plugin</description> <ns2:testcase href="https://almdev.cl.internal.ericsson.com:443/qm/secure/service/com.ibm.rqm.integration.service.IIntegrationService/resources/DUCI_AXE_IV_PMT/testcase/MBT_Testing+MBT_testcase_1"/> <ns2:testcase href="https://almdev.cl.internal.ericsson.com:443/qm/secure/service/com.ibm.rqm.integration.service.IIntegrationService/resources/DUCI_AXE_IV_PMT/testcase/MBT_Testing+MBT_testcase_2"/> <ns2:testcase href="https://almdev.cl.internal.ericsson.com:443/qm/secure/service/com.ibm.rqm.integration.service.IIntegrationService/resources/DUCI_AXE_IV_PMT/testcase/MBT_Testing+MBT_testcase_3"/> </ns2:testplan>I do get a 200 response back which according to REST API means the update was successfull.
https://jazz.net/wiki/bin/view/Main/RqmApi#Update
However, I cannot see the test cases linked inside the test plan from the Web UI. Is there something I am missing ?
3 answers
Can you do a GET on
https://almdev.cl.internal.ericsson.com:443/qm/secure/service/com.ibm.rqm.integration.service.IIntegrationService/resources/DUCI_AXE_IV_PMT/testcase/MBT_Testing+MBT_testcase_1
and check if you get testcase resource's xml on this URL.
Seems all thinks correct. As a advice please do a GET on artifact,
then edit xml to make modification and upload it.
Otherwise you might loose some other info of test plan as
REST API does not support partial update
Hi Pramod.
Thanks for your reply. The root cause was the RQM ID names for the test cases. RQM doesn't seem to like the "+" symbol, so I replaced it with an underscore.
For instance:
MBT_Testing+MBT_testcase_1
was converted to
MBT_Testing_MBT_testcase_1
Regards,
Athanasios
Thanks for your reply. The root cause was the RQM ID names for the test cases. RQM doesn't seem to like the "+" symbol, so I replaced it with an underscore.
For instance:
MBT_Testing+MBT_testcase_1
was converted to
MBT_Testing_MBT_testcase_1
Regards,
Athanasios
Comments
Correct. Reserved URL characters in external IDs must be URL-encoded (see https://jazz.net/wiki/bin/view/Main/RqmApi#External_ID).
@Athanasios - Did you rename the testcase?
For me none of your proposals work.
I've tried these for my testcase with title test+test:
.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTAREA/testcase?fields=feed/entry/content/testcase[title='test+test']/
.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTAREA/testcase?fields=feed/entry/content/testcase[title='test%2Btest']/
.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTAREA/testcase/test+test
.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTAREA/testcase/test%2Btest
Either I got a "Bad request" back, or a xml with no testcase information inside:
Thanks for your help to get this work,<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">testcase ATOM feed for project area xy</title>
<id>.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/pa/testcase</id>
<link href=".../qm/web/console/" rel="alternate"
/>
<link rel="self" href=".../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/pa/testcase?fields=feed%2Fentry%2Fcontent%2Ftestcase%5Btitle%3D%27test+test%27%5D%2F*"
/>
</feed>
</pre>
Dani
Comments
Dani,
This is a variant of defect 183538: Test Case Result records incorrectly shown as Previous Result Records when exporting Test Case Result to PDFs when PA contains "+" in the name. However, this defect involves encoding the project area alias whereas your issue is with encoding the fields request/query value. Note, the entire fields request/query value should be URL-encoded. If this doesn't work, please open a new defect.
Paul
Hi Paul
Thanks for your answer. Unfortunately we can't filter for these testcases with the Rest Api.
We created an defect for this problem: Test cases with special character '+' yielding bad requests via REST API
Thanks,
Dani
Comments
SaiKiran Cheemakurthi
Mar 09 '13, 11:26 p.m.will you please share the XML for Creating Test cases and the PUT Method?