It's all about the answers!

Ask a question

Retrieve linked test cases from a Work Item

Antonio Dionisio (1715) | asked Nov 16 '16, 7:18 a.m.
edited Nov 16 '16, 7:19 a.m.
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

Accepted answer

permanent link
Miguel Tomico (5001423) | answered Nov 16 '16, 8:16 a.m.
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

Antonio Dionisio commented Nov 16 '16, 10:13 a.m. | edited Nov 16 '16, 10:24 a.m.

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/  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:
How can I know the test case id with the retrieved link?

Miguel Tomico commented Nov 21 '16, 4:03 a.m. | edited Nov 21 '16, 4:05 a.m.

Apologies for the late response.

In your example, the external UUID of the Test Case is:


Therefore, the REST call to GET the resource using this external ID would be as follows:

https://<jazz server>:<port>/qm/service/

Have a look at this article about retrieving RQM resources using Internal or External IDs.

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.