Retrieve linked test cases from a Work Item
![]()
I have to retrieve information about the Test Cases that are linked to a given Work Item. I am using RTC 5.0.1 and Java API.
Thanks to other questions and blogposts I have managed to get throught the links of a Work Item, but I am stuck on how to retrieve the TestCase itself. Is there any way to get the Test Cases? private void getLinks(ITeamRepository repo, IWorkItem wi) throws TeamRepositoryException{ ILinkManager linkManager = (ILinkManager) repo.getClientLibrary(ILinkManager.class); IItemReference itemReference = linkManager.referenceFactory().createReferenceToItem(wi); ILinkCollection linkCollection = linkManager.findLinksBySource(itemReference, null).getAllLinksFromHereOn(); System.out.println("\tWorkItem has " + linkCollection.size() + " links"); for (ILink link: linkCollection) { IItemHandle linkHandle = (IItemHandle) link.getTargetRef().resolve(); System.out.println("\t" + link.getThisEndpointDescriptor(link.getTargetRef()).getDisplayName() + " " + link.getTargetRef().getClass()); } } This method currently outputs: Work Item has 1 links Tested By Test Case class com.ibm.team.links.internal.links.impl.ReferenceImpl |
Accepted answer
![]()
Unfortunately, RQM does not have a Java API like RTC.
You will need to make OSLC calls to retrieve the detail of the Test Cases. If you need this for reporting purposes, I would consider JRS. Antonio Dionisio selected this answer as the correct answer
Comments Miguel, thanks for you answer. So I have the url to the linked test (something like this: https://localhost:9443/qm/oslc_qm/contexts/_ueOOYKgQEeaPaoGRbbL1BA/resources/com.ibm.rqm.planning.VersionedTestCase/_LsP4sKqLEeaPaoGRbbL1BA). If I want to call for this specific test case in a REST call how do I know what is this test case id? As I have read the REST call would be like this:
Apologies for the late response. In your example, the external UUID of the Test Case is: _LsP4sKqLEeaPaoGRbbL1BA Therefore, the REST call to GET the resource using this external ID would be as follows: https://<jazz server>:<port>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_ueOOYKgQEeaPaoGRbbL1BA/testcase/_LsP4sKqLEeaPaoGRbbL1BA Have a look at this article about retrieving RQM resources using Internal or External IDs. |
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.