Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link
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

0 votes

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:
https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/[PROJECT]/testcase/urn:com.ibm.rqm:testcase:32
How can I know the test case id with the retrieved link?

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.

https://www.ibm.com/developerworks/community/blogs/e4210f90-a515-41c9-a487-8fc7d79d7f61/entry/rqm_rest_api?lang=en

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 411
× 369
× 45

Question asked: Nov 16 '16, 7:18 a.m.

Question was seen: 3,059 times

Last updated: Nov 21 '16, 4:05 a.m.

Confirmation Cancel Confirm