It's all about the answers!

Ask a question

Can't assign (RTC) defect to (QM) executionresult via API


Enrique Sánchez (432) | asked May 03, 5:02 p.m.
edited May 03, 5:07 p.m.

 I'm trying to create/update a QM executionresult that, in a particular step, has a CCM workitem attached.


If I create the executionresult via Jazz web interface and then check it via API, the execution result XML looks like the following, in which the workitem is attached to a property into the stepResult object (see properties tag):

<ns16:stepResults>
    <ns16:stepResult stepIndex="1" result="com.ibm.rqm.execution.common.state.passed" startTime="2022-02-11T08:55:58.000Z" endTime="2022-02-11T08:55:58.000Z">
        <ns16:properties>
            <ns16:property propertyName="defecto test 01" propertyValue="https://[IP]:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/26" propertyType="rtcdefectView"/>
        </ns16:properties>
        <ns16:startTime>2022-02-11T08:55:58.000Z</ns16:startTime>
        <ns16:endTime>2022-02-11T08:55:58.000Z</ns16:endTime>
        <ns16:result>com.ibm.rqm.execution.common.state.passed</ns16:result>
        <ns16:expectedResult>
            <div xmlns="http://www.w3.org/1999/xhtml">test</div>
        </ns16:expectedResult>
        <ns16:actualResult></ns16:actualResult>
        <ns16:description>test</ns16:description>
        <ns16:stepType>com.ibm.rqm.execution.common.elementtype.execution</ns16:stepType>
        <ns16:comment/>
        <ns16:compare/>
    </ns16:stepResult>
</ns16:stepResults>

I've tried (all via API):
  • First, I create the workitem. Then, I create the executionresult with a link to the workitem as seen above. But it doesn't work: the executionresult is created but the defect does not appear on it.
  • First, I create the executionresult. Then I create the workitem and I link it to the executionresult. After that, I try to update the executionresult (via PUT request) adding the workitem to the step. But the workitem still does not appear in the executionresult.

Any clues on what could I be missing?


Comments
Ralph Schoon commented May 04, 2:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Nothing in the XML above looks like anything I would expect in RDF+XML which is the supported format for OSLC.

Accepted answer


permanent link
Enrique Sánchez (432) | answered May 05, 12:25 p.m.

 I now have a solution that works.


  1. I create the defects in CCM via OSLC API.
  2. I create the ExecutionResult that contains each step result (without links) via QM Reportable API (only because that is how I was doing it before).
  3. I retrieve the ExecutionResult XML (created in 2) via QM OSLC API 2.0 (https://[IP]:9443/qm/oslc_qm/contexts/[areaId]/resources/com.ibm.rqm.execution.ExecutionResult/[executionId])
  4. From the XML obtained in 3, I extract the step results URLs from the <rqm_qm:containsStepResult> tags.
  5. I perform a GET to the ExecutionElementResult URL (obtained in 4) to those steps I want to attach a defect to (https://[IP]:9443/qm/oslc_qm/contexts/[areaId]/resources/com.ibm.rqm.execution.ExecutionElementResult/[stepResultId]) to retrieve the XML.
  6. In the previous XML, I add one <oslc_qm:affectedByChangeRequest> tag for each defect I want to link.
  7. I use the modified XML to perform a PUT to the same URL used in 5.
Now the defect appears linked to the step in the execution result.

Thank you for the support and sorry if I was approaching the problem in a wrong way from the beginning. I guess I should have only used the OSLC API but I found the Reportable API more convenient for some of the operations.

Ralph Schoon selected this answer as the correct answer

Comments
Ralph Schoon commented May 06, 2:16 a.m. | edited May 06, 2:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Thanks for sharing. 


There are limitations in the OSLC API, so best use whatever works for you, I guess.


Ralph Schoon commented May 06, 7:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

PS: I am not able to create the link in the work item by saving a test case using the reportable REST API. My assumption is, that the link need to be created in EWM in that case. 


Ralph Schoon commented May 06, 7:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note that https://jazz.net/wiki/bin/view/Main/RqmApi#Notable_changes_from_ETM_7_0_1_t mentioned the API change for work item and advertises to use the ETM OSLC API for work item linking.

3 other answers



permanent link
Ralph Schoon (60.9k33643) | answered May 04, 2:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited May 04, 2:54 a.m.
I am not sure what you are trying to do there and what API you refer to, but this is what a link to a work item in a ETM artifact would look like in the OSLC API (the link type could be different.):


Comments
Enrique Sánchez commented May 04, 6:42 a.m. | edited May 04, 6:54 a.m.

Yes sorry I am talking about the OSLC API. I am attaching a Jazz web interface screenshot of what I am trying to replicate via OSLC API.


 
Screenshot of Jazz interface showing an execution result with a defect linked to one of the steps


Here is how the OSLC API shows the link in the execution result. That format is what I am trying to use to replicate the link of the defect to the execution result.
Same execution result reported via OSLC API in XML format


Ralph Schoon commented May 04, 6:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I can't see the images. Try to use Chrome to attach them. Please edit your comment.


Enrique Sánchez commented May 04, 12:56 p.m.

Updated. Images should be visible now  


Ralph Schoon commented May 05, 5:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Your linked work item is a PROPERTY of the enclosed test step and not a LINK to the execution result you are saving. I am not sure if there is a way to modify the step result. I would try to have a link on the executionresult level first, before becoming adventurous. 


permanent link
Ralph Schoon (60.9k33643) | answered May 05, 2:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited May 05, 3:31 a.m.
This is a typical case of wasting time on the forum because the most basic information needed is not in the question in the first place. This is especially crucial if you ask about APIs. If you had provided an example link that you GET/POST we could have solved the mystery already.

1. Jazz products have many APIs. There are internal APIs, there are common/shared APIS such as the Jazz process
API, there are REST APIs, there are SDK's and Java or Java Script APIs.

Read that page to understand the APIs available to you.
Understand which API you are trying to use and name it in questions.
 
2. For RQM/ETM, in addition to the ones already mentioned there is an OSLC API and there is a REPORTABLE REST API.

As far as I can tell, just seeing the URL you try to use containing IIntegrationService in detail service/com.ibm.rqm.integration.service.IIntegrationService tells us you are trying to use the REPORTABLE REST API in the hope to be able to link the work item. In my mind the Reportable REST APIs are for reporting. They seem to support POST and PUT, but I have no examples for how that all works.

Sorry, I have not much experience with the Reportable REST API and if you can link items that way. 

I was talking about the OSLC API. I know the OSLC API and you definitely can link items using that one.

Comments
Ralph Schoon commented May 05, 2:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

https://jazz.net/forum/questions/279587/how-to-create-test-result-via-reportable-rest-api-oslc-api-in-etm might be a good place to start about this. I am not sure. There might be other examples if you google for RQM reportable rest API RQM site:jazz.net and maybe throw PUT or POST into the first part of the search string.


Ralph Schoon commented May 05, 2:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

PS: Only RQM allows to create/update anything using the reportable REST API, all other applications only allow it for getting information.


Maybe using the RQM URL Util provides better feedback. Not sure.
 


Enrique Sánchez commented May 05, 4:23 a.m.

Sorry for the lack of clarity and wasting of time! Thanks for the information links.


From what I get from the OSLC QM V2 API (https://[IP]:9443/qm/oslc_qm/contexts/[IP]/resources/com.ibm.rqm.execution.ExecutionResult), there is only a affectedByChangeRequest  section that links the defect to the execution result, but that does not provide information about which step the defect is linked to. So, I can link the defect but it only appears as related to the execution result and can't be traced to a step.

The ETM Reportable REST API 7.0.3 does provide the information I was looking for, i.e., linking the defect as an attachment to a particular step in the execution result.


Enrique Sánchez commented May 05, 4:25 a.m.

P.S.: The creation of the executionresult works OK with the Reportable REST API, but I'm only missing the defect linking. I will be making more tests to see if I manage to do it.


Ralph Schoon commented May 05, 4:38 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The ETM reportable RESt API is an API for ETM. You assume that it handles changes in links to the other applications. It is not clear if this assumption is valid and, especially, if the backlinks in the remote applications are created if necessary.


Enrique Sánchez commented May 05, 4:48 a.m.
Yes that's a good point.

The OSLC format links the step result to the execution result with the containsStepResult tag. It should be possible to link an ExecutionElementResult to the defect with its affectedByChangeRequest tag. I am trying that the next.


Ralph Schoon commented May 05, 6:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

To make this absolutely clear once and for all, there is no OSLC and no OSLC related format, information or anything else to be seen in this whole post.

Everything in this communication is reportable REST API. OSLC looks and works totally different and is not interchangeable.

showing 5 of 7 show 2 more comments

permanent link
Ralph Schoon (60.9k33643) | answered May 05, 9:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I took some time to understand the ETM/RQM Reportable REST API better. I am able to use POST and PUT to create a test case. When I copy the entry for a related work item


<ns2:relatedChangeRequest href="https://elm.example.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/45" rel="trackedBy" summary="45: Implement - Organizations may apply with an initial request"/>

from another test case and submit this in a PUT, I do not get a relationship between the work item and the test case. 

It is absolutely possible that I can only create such a relationship from EWM, by creating a link in the work item. This would require the OSLC API.

If someone has other experience I would be interested in any insight that can be provided.

Your answer


Register or to post your answer.