It's all about the answers!

Ask a question

How can I use the Java API to link RQM test case/results to RTC work items?


Chandrahasa Reddy D (5715260) | asked Jul 04 '12, 5:03 a.m.
edited Jul 04 '12, 7:58 a.m. by Geoffrey Clemm (30.1k33035)
Hi,
I have defect created in RTC and I want to link it to certain artifacts in RQM say test case/test case results? How can achieve this using RTC API given ?

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jul 04 '12, 8:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

the solution I found for this with the RTC Java API looks as follows:

    private static class LinkURIOperation extends WorkItemOperation {

       
        private URI fURI;
        private IEndPointDescriptor fEndpointDescriptor;
       
        public LinkURIOperation( IEndPointDescriptor endpointDescriptor,URI uri) {
            super("Linking URL", IWorkItem.FULL_PROFILE);
            fURI = uri;
            fEndpointDescriptor=endpointDescriptor;
        }

        @Override
        protected void execute(WorkItemWorkingCopy workingCopy,
                IProgressMonitor monitor) throws TeamRepositoryException {
            IReference reference;
                reference = IReferenceFactory.INSTANCE.createReferenceFromURI(fURI);
                workingCopy.getReferences().add(fEndpointDescriptor,reference);
        }
    }

The example is based on the https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation operation.
It requires to have the URI for the other element and the call would look like:

                    URI uri=new URI("https://clm.example.com:9448/qm/oslc_qm/contexts/_Lm2UIACBEeGZqMjM3RLKTw/resources/com.ibm.rqm.planning.VersionedTestCase/_dJzNgQCBEeGZqMjM3RLKTw");
                    IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.TESTED_BY_TEST_CASE).getTargetEndPointDescriptor();
                    LinkURIOperation linkOp = new LinkURIOperation(endpoint,uri);
                    linkOp.run(workItem, monitor);

Or for other Link types:
                    IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTS_EXECUTION_RESULT).getTargetEndPointDescriptor();
                    LinkURIOperation linkOp = new LinkURIOperation(endpoint,uri);
                    linkOp.run(workItem, monitor);

Or

                    IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTED_BY_DEFECT).getTargetEndPointDescriptor();
                    LinkURIOperation linkOp = new LinkURIOperation(endpoint,uri);
                    linkOp.run(workItem, monitor);

Or any matching link type.

Chandrahasa Reddy D selected this answer as the correct answer

Comments
Chandrahasa Reddy D commented Aug 10 '12, 6:32 a.m.

How do we get the URI of the test case ?

3 other answers



permanent link
Ralph Schoon (63.1k33646) | answered Aug 10 '12, 3:30 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
RTFC uses an OSLC based picker. You either have the URL, or, I think, you have to do something similar.

Comments
Chandrahasa Reddy D commented Aug 14 '12, 6:44 a.m.

Hi Ralph, We are able to attach the test case to defect by using this. Thanks for that. But it was really hard coded URI. If I want to attach different test cases to different defects then at run time we need to get URI of these test cases. Is there any method where we can get this URI of the test case by using test case id / some other means? Sorry we are coming from ground level, so need your low level explanation.


permanent link
Stephane Leroy (1.4k149) | answered Aug 16 '12, 1:31 p.m.
JAZZ DEVELOPER
edited Aug 16 '12, 1:35 p.m.
Hi Chandrahasa,

you could build your test case-associated URIs by using the following pattern :
https://hostname:port/context_root/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project_area_name/testcase/urn:com.ibm.rqm:testcase:test_case_ID

Regards,
Stephane Leroy
Jazz Jumpstart

Comments
Chandrahasa Reddy D commented Aug 20 '12, 8:18 a.m.

Hi, I created defect and this defect is linked to test case pragmatically.. but from RQM test case results, defect section does not contain this actual defect. here I am not able to establish backward traceability. How can achieve this.?


Stephane Leroy commented Aug 20 '12, 9:24 a.m.
JAZZ DEVELOPER

Hi,

I'm not sure what you're exactly trying to do... but wonder if there is kind of mixing between the links to : - 1 - the development W.I. associated to the test case (CLM link "Tested by test case" ) and - 2 - a defect that would be created by a tester as a result of the execution of a test execution record ("Affect test result" link) ? These are very different stories.

If that's the case, you'd certainly go for programatically adding the defect at the test case execution level (versus your current linking to the Test Case) and then, you should now find your defect listed.

Unless I missed you scenario.

Stéphane


Chandrahasa Reddy D commented Aug 21 '12, 2:23 a.m.

Hi, We are trying to create defects in RTC for test case failures in RQM. We are able to create the defects and mark the test case links for traceability. Now we want to link this defect in RQM test case results also. How can we achieve this pragmatically. we want both from RTC defect--> RQM test case and RQM test case results-->RTC defect. hope it clarifies.


Ralph Schoon commented Aug 21 '12, 2:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Using the Plain Java Client Libraries/Java API you can create all link endpoint types available in RTC. So if the endpoint you want is available, you can do that. I would suggest to create this linkage to an RTC work item and then analyze the relationships. You can also determine the endpoint available from the WorkItemLinkTypes as shown above.


Chandrahasa Reddy D commented Sep 03 '12, 2:58 a.m.

Can we add defects in "defects" section of RQM test case execution record? This is because when we link RQM test case in RTC defect, its not creating defect in "defects" section of RQM test case execution record where as if I add defects from RQM, it creates both forward and backward links..


permanent link
Ralph Schoon (63.1k33646) | answered Sep 17 '12, 3:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The plain Java Client Libraries are an RTC API and work only for RTC artifacts such as work items.

Your question "Can we add defects in "defects" section of RQM test case execution record? This is because when we link RQM test case in RTC defect, its not creating defect in "defects" section of RQM test case execution record where as if I add defects from RQM, it creates both forward and backward links.."


My assumption would be that RQM shows data based on link types on the work item. I would check which links are available in a work item that shows up where you want it and to create the required links on the work item. Then it should show up where it needs to.

Comments
Chandrahasa Reddy D commented Dec 07 '12, 4:32 a.m.

I tried all the link types available.. still its creating links on work item only but not on RQM execution result.


Ralph Schoon commented Dec 07 '12, 5:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The Plain Java Client Libraries are for RTC, as far as I can tell. So you can use it to create links on RTC Work Items to any linkable URI type. But you can probably not use it to create links on RQM artifacts to other RQM artifacts. What are you trying?

See https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ for examples. You can create links on work items to test results and test execution results by providing the URI to said elements. This will create the back link on the QM artifact.

Best approach would be to create the links you want and then read the work item to figure the link type out.


Chandrahasa Reddy D commented Dec 07 '12, 5:17 a.m. | edited Dec 07 '12, 5:18 a.m.

I have created work Item in RTC. I want to link this work item to RQM Test Case execution result in "defect" section.
I am not able to open the link "https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/"..

Please suggest.


Ralph Schoon commented Dec 07 '12, 6:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER


See https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ for examples.

these are some of the endpoints. IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.TESTED_BY_TEST_CASE).getTargetEndPointDescriptor(); IEndPointDescriptor endpoint1 = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTS_EXECUTION_RESULT).getTargetEndPointDescriptor(); IEndPointDescriptor endpoint3 = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTED_BY_DEFECT).getTargetEndPointDescriptor(); IEndPointDescriptor endpoint4 = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.BLOCKS_EXECUTION_RECORD).getTargetEndPointDescriptor(); IEndPointDescriptor endpoint5 = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.RELATED_EXECUTION_RECORD).getTargetEndPointDescriptor();

However, it does not seem to create the backlink in the QM item.


Chandrahasa Reddy D commented Jan 01 '13, 4:22 a.m.

I tried all of these link types but does not create back linkage....Any idea how to create back link in RQM? do we have any other approach?


Ralph Schoon commented Jan 02 '13, 5:14 a.m. | edited Jan 02 '13, 5:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I think I remember I took some time to explore this and also had issues with the back links. I however did not have the time to take a closer look in the Eclipse client, how it is implemented there. I would suggest to plug-in spy the dialog in the Eclipse client and try to understand how it does the back linking. I am out of other ideas at this time.

showing 5 of 6 show 1 more comments

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.