RQM REST API for Creating Test case
7 answers
Comments
Brian,
Using Poster, perform a GET on an existing test case to get sample xml. Your testscript URL looks fine. The singleProjectFeedURL for testcases (what you should set your url variable to) would be: https://MyRQM:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/WAW_Refactoring/testcase
1 vote
+1 on Brian's answer.
For other examples of URLs (including the one just cited above), you could refer to this post: http://sleroyblog.wordpress.com/2013/04/09/querying-rqm-40-through-oslc-and-rest-api/
1) You are not authenticating with the RQM server. I would suggest using the HTTP client in the RQM URL Utility or RQM Copy Utility source.
2) Your test script URL contains entity references:
https:/MyRQM:9443/jazz/service<b>/com.ibm.rqm.integration.service.IIntegrationService</b>/resources/WAW_Refactoring/testscript/urn:com.ibm.rqm:testscript:256
Comments
Paul,
Hi Sai,
See https://jazz.net/wiki/bin/view/Main/RqmApi#ScenarioCreateTip for the steps to create valid resource XML.
I was able to create my test cases via Rest api but I need to obtain the identifier of those test cases so I can link them to the test plan. When I post xml representation of my test case, I only got HTTP 201 nothing more.
Could you help me?
Comments
The Content-Location response header will contain the ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#Create).
1 vote
After posting the question I found out my response by myself. I was looking at the wrong side :)
I am trying to put a value to Categories while creating the Test Plan or Test Case.
I added "<ns4:category value=\"Unit Test\" term=\"Test Phase\"/>" to my TestPlan xml but Categorie is ot set after the execution.
Is there any restriction on some field like Categories,owner,etc?
Comments
Try:
<ns4:category value="Unit Test" term="Test Phase"/>
You may also not have the correct permissions (check the RQM log for relevant log messages).
I gave all the permissions to my user in Test Plan Permissions.
I also cannot edit owner of the test plan via REST api.
I'll try your solution.
I guess jazz.net editor corrupted my xml value. I have <ns4:category value=\"Unit Test\" term=\"Test Phase\"/> this in mycode snippet.
Is there anything in the HTTP response content and/or RQM logs?
Test Plan is created. I got HTTP 201 message.
Logs are:
2014-07-24 17:01:06,644 [WebContainer : 1 @@ 17:01 Jazz_Report_User /qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan] WARN com.ibm.rqm.integration.service - IntegrationService:handleRequest AQXIN2512W The request URI contains invalid characters. In the request URI, resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan, this segment is invalid: urn:com.ibm.rqm:testplan.
2014-07-24 17:01:06,924 [WebContainer : 1 @@ 17:01 Jazz_Report_User /qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan] WARN com.ibm.rqm.planning - POST with id is improper usage; please do not provide the known id
Comments
You cannot not use an internal ID on a PUT request (see https://jazz.net/wiki/bin/view/Main/RqmApi#Internal_ID). In this case, the invalid ID is ignored and a generated ID is used.
"urn:com.ibm.rqm:testplan" is an internal id?
I found the problem.
My problem was that my tag ids didnt match.
The right usage is:
xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns4="http://purl.org/dc/elements/1.1/"
<ns2:category value="Unit Test" term="Test Phase"/>
The wrong usage is
xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns4="http://purl.org/dc/elements/1.1/"
<ns4:category value="Unit Test" term="Test Phase"/>
I mistakenly put ns4 instead of ns2.
Good catch. Namespace prefixes can sometimes be tricky. I would have assumed an error/warning would have been logged in the RQM log.
Yes, urn:com.ibm.rqm:testplan is an internal id (except it's missing the web ID). Note, you cannot use an internal ID in create (POST/PUT) requests.
1 vote
If I dont use urn:com.ibm.rqm:testplan I cannot create anything.
What's the disadvantages of using it?
Please read https://jazz.net/wiki/bin/view/Main/RqmApi#id.