It's all about the answers!

Ask a question

How to fetch test cases from test plan using RQM REST API?


0
1
Andrew Ciaz (59160) | asked Dec 23 '20, 8:29 a.m.

 Hi all,


I have test plan which has some test cases I tried below URL to fetch the test cases but no test cases shown in the response, please suggest the solution:

https://<serverUrl>/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>/testcase?fields=feed/entry/content/testcase/(*|testplan[@href='https://<serverUrl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>/testplan?fields=feed/entry/content/testplan/urn:com.ibm.rqm:testplan:12'])

6 answers



permanent link
Ian Barnard (1.9k613) | answered Nov 26 '21, 1:03 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 29 '21, 4:55 a.m.

AFAICT test plans are related directly to test cases, but not the reverse. Also, it's not possible to filter on the id but it is possible on the title, so for example for a test plan 'Development Test' this gets only the testcases for that test plan:

https://SERVER:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Alias>/testplan?fields=feed/entry/content/testplan[title='Development Test']/testcase
The result has an entry for each testcase like:
The filterable fields are documented https://jazz.net/wiki/bin/view/Main/RqmApi#SupportedFieldsResources in the third column of the table below the heading 'Supported Resources and Properties:' - scroll down to the testplan section.

If your project is configuration-managed see https://jazz.net/wiki/bin/view/Main/RqmApi#Notable_changes_from_ETM_5_0_to you'll have to add &oslc_config.context= and the URL-encoded configuration URI to the URL, so for example the complete URL before encoding might be:
  • https://SERVER:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Alias>/testplan?fields=feed/entry/content/testplan[title='Development Test']/&oslc_config.context=https://SERVER:PORT/qm/oslc_config/resources/com.ibm.team.vvc.Configuration/_tS6zI0B1Eeus6Zk4qsm_Cw
(It's also possible to instead provide the configuration using a header Configuration-Context, see https://jazz.net/wiki/bin/view/Main/RqmApi#Notable_changes_from_ETM_5_0_to)

After URL encoding the configuration URL becomes the actual URL used:
  • https://SERVER:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Alias>/testplan?fields=feed/entry/content/testplan[title='Development Test']/&oslc_config.context=https%3A%2F%2FSERVER%3APORT%2Fqm%2Foslc_config%2Fresources%2Fcom.ibm.team.vvc.Configuration%2F_tS6zI0B1Eeus6Zk4qsm_Cw

Also please note this above is not an OSLC API, it is the reportable REST API. See https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api

You may well be able to retrieve similar info using OSLC Query or through the OSLC APIs.

HTH
Ian


permanent link
Subramanya Prasad Pilar (4.6k15) | answered Dec 23 '20, 9:25 a.m.
Can you try the following?
https://<server>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>/testcase?fields=feed/entry/content/testcase/(*|testplan/@href='https://<server>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>/testplan/urn:com.ibm.rqm:testplan:12'])

Comments
Andrew Ciaz commented Dec 23 '20, 11:20 a.m.

 @Subramanya Prasad Pilar Thanks for your response, but the above URL returns all the test cases from the project area. My test plan has only one test case


Subramanya Prasad Pilar commented Dec 23 '20, 12:18 p.m.

The above URL should return only test cases belonging to testplan:12


Subramanya Prasad Pilar commented Nov 28 '21, 1:10 a.m.

Note that now you must encode the entire parameter value when the project alias is a part of a URL parameter.


permanent link
Rajat Krishnan (7015) | answered Nov 26 '21, 6:19 a.m.
Hello @Andrew Ciaz,
By any chance, Did you got any solution for this thread, if yes , could you please share?
Thank you

Comments
Chandan M B commented Nov 26 '21, 9:39 a.m. | edited Nov 26 '21, 9:39 a.m.

Rajat Krishnan commented Nov 26 '21, 11:54 a.m. | edited Nov 26 '21, 11:59 a.m.
Hello @ Chandan M B
Thanks for quick response but looks like Andrew was correct , we are getting list of test cases which is not even linked with testplan , also i want to give you a short overview on how our RQM Project Structure looks like :
We have Project Area called Customer_QM and under that we different component created like electronics.HP , electronics.Havells etc with each component binded with stream , is it because of that this oslc api not working as excepted ?

Also if possible could you please provide me oslc api with the help of which i can retrieve test plan details like Summary,Test Cases,Test case execution record,..(refer attachment) in some format maybe json or something
Thank you

Test Plan Section

permanent link
Rajat Krishnan (7015) | answered Nov 27 '21, 8:17 a.m.
Hello @Ian Barnard,
Thanks for addressing my query,
May i know where exactly i need to add "&oslc_config.context= and the configuration URI to the URL" in this url

/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Alias>/testplan?fields=feed/entry/content/testplan/[id=1]

Thanks


Comments
Ian Barnard commented Nov 29 '21, 4:56 a.m. | edited Nov 29 '21, 5:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please don't add another answer when you want to comment on my answer, which I've updated. 


permanent link
Alex K. (133) | answered Oct 25 '23, 8:16 a.m.
Can anyone explain why when I need to retrieve data from Jira via restapi for the very first time in my life, I get it done in a couple of hours.
But when I need to do the same from RQM, it takes me over two days, even though I have experience with RTC?

Comments
Ralph Schoon commented Oct 25 '23, 9:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I think this is a valid question and agree it is a problem. The issue is though why you don't create your own question, but post this as an answer to a question someone else asked. Please consider converting this answer to your own question. 


permanent link
Alex K. (133) | answered Nov 03 '23, 2:18 p.m.

Hello all, I had the same issue in my project.

And I was able to find the reason and a solution for it.
It was caused by a bug in my RQM version 7.0.2 SR1
See Workarounds and Limitations: Known issues in IBM Engineering Test Management 7.0.2  
Item "Inconsistent encoding and decoding for ETM Reportable REST API URLs with project aliases, external IDs, and query parameter values"
Despite the fact that it was already a service release, the bug from the original 7.0.2 release was still there.

My very first workaround was to take all the entries and filter them on my end using python.
It was not optimal, but it worked so at least I was able to proceed on other topics.

Solution: I had to escape the part of the url that starts after "fields=" section.
I used python:
import urllib.parse
fields_part="feed/entry/content/testcase/(*|testplan[@href='https://<serverUrl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>/testplan"
urllib.parse.quote(fields_part, safe='')
# Note, "safe" parameter is required, because the slashes remain not escaped by default.

And it took me at the end about four working days to find the real cause of the problem.
I wasn't a big fan of the Jazz Platform (believe me, there are reasons for that). But now after this experience, please understand that I now hate it with all my heart!

Your answer


Register or 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.