It's all about the answers!

Ask a question

How to Update Test Script Sections contents via the RQM Reportable REST API?


Victor Polo de Gyves Montero (135) | asked Feb 26 '19, 9:32 a.m.
edited Feb 26 '19, 10:02 a.m.

(Please note: This same method updates correctly Test Plan and Test Case Sections: only fails to update Test Script Sections).

Which are the missing steps or instructions to update a Test Script Section, created by a Test Artifact Template for a Configurations-Enabled RQM project at CLM 6.0.6?


Given the following test script in RQM, we have created it using a custom test artifact template which adds two sections: “RichTextSection” and “GridSection”.


RichTextSection” section should contain free-form rich text data. “GridSection” section should contain a grid with two columns of data.



So, I created the next code to get the XML of the test scripts and its ETag. I must remind that this same method correctly updates test plan sections and test cases sections but not test script sections:


// Get XML of test script
RqmApiClient customClient = new RqmApiClient(jtsUri, username, password);
customClient.login();
HttpClient httpClient = customClient.getHttpClient();
String uri = "https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29" + "/executionscript/urn:com.ibm.rqm:executionscript:171"
HttpGet httpUriRequest = new HttpGet( uri + "?oslc_config.context="+conf3 + "&abbreviate=false" )
HttpResponse response = httpClient.execute( httpUriRequest );
HttpEntity entity = response.getEntity();
String result = EntityUtils.toString(entity);
writeStringToFile(result, "out/getTestScriptResourceFromRqmApi.xml");
String ETag = response.getHeaders( "ETag" )[0].getValue();

Then, I change the file at out/getTestScriptResourceFromRqmApi.xml to update the test script’s title, description and the values at the sections “RichTextSection” and “GridSection” using the following code:


// Update test script
HttpPut httpPut = new HttpPut( uri + "?oslc_config.context="+conf3 );
File file = new File("out/getTestScriptResourceFromRqmApi.xml");
String resourceFromFile = new String (Files.readAllBytes(file.toPath()),Charset.forName("UTF-8"))
httpPut.setEntity(new StringEntity( resourceFromFile ));
httpPut.addHeader("ETag", ETag);
httpPut.addHeader("If-Match", ETag);
HttpResponse response = httpClient.execute( httpPut );
System.out.println(response.getStatusLine());

After that, the RQM application answers, as expected:


HTTP/1.1 200 OK

BUT only the title, the description and the test script steps of the test script are updated! No updates of the custom test section are honored by the RQM API: Cells marked with red circles should show A5 and B5 labels, instead of A1 and B1, so that data was NOT UPDATED. But, title and description, marked with green circles are correctly updated.




Interestingly, Manual test script steps were correctly updated:




The data of RichTextSection was not updated: Data on red circle should say: “Some additional info update 5”. But again, no update for both sections.





So, what is wrong/what additional steps or information should be done to update sections for a test script created using a custom template? Could you provide an example?


As additional information, I include the XML to PUT, with the data updated.


XML used to PUT (update) the test script:


<?xml version="1.0" encoding="UTF-8"?>
<ns2:executionscript xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns1="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://purl.org/dc/elements/1.1/" xmlns:ns4="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://purl.org/dc/terms/" xmlns:ns7="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns10="http://open-services.net/ns/core#" xmlns:ns11="http://open-services.net/ns/qm#" xmlns:ns12="http://jazz.net/xmlns/prod/jazz/rqm/process/1.0/" xmlns:ns13="http://www.w3.org/2002/07/owl#" xmlns:ns14="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns15="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns17="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns18="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns20="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/" xmlns:ns21="http://www.w3.org/1999/XSL/Transform">  <ns2:projectArea href="https://xxx.xxx.com:9443/qm/resource/itemOid/com.ibm.team.process.ProjectArea/_N0wpwfp3EeeN8owPg66FiQ" alias="YYY+YYY+YYY+Development+%28Quality+Management%29"/>
 <ns3:identifier>https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29/executionscript/urn:com.ibm.rqm:executionscript:171</ns3:identifier>
 <ns2:webId>171</ns2:webId>
 <ns3:title>DemoTestScript1 update5</ns3:title>
 <ns3:description>Demo description update5</ns3:description>
 <ns2:creationDate>2019-02-25T21:20:15.355Z</ns2:creationDate>
 <ns5:updated>2019-02-26T01:43:58.143Z</ns5:updated>
 <ns5:state ns7:resource="https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_N0wpwfp3EeeN8owPg66FiQ/workflowstate/com.ibm.rqm.process.testscript.workflow/com.ibm.rqm.planning.common.new">com.ibm.rqm.planning.common.new</ns5:state>
 <ns3:creator ns7:resource="https://xxx.xxx.com:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/vdegyves">vdegyves</ns3:creator>
 <ns5:owner>unassigned</ns5:owner>
 <ns2:locked>false</ns2:locked>
 <ns2:variables/>
 <ns2:includeBuiltInVars>false</ns2:includeBuiltInVars>
 <ns2:scriptStepCount>2</ns2:scriptStepCount>
 <ns2:steps>
   <ns2:step stepIndex="1" ns6:type="execution" ns7:about="https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29/executionscript/urn:com.ibm.rqm:executionscript:171?step=_JL48tTlDEemQpdPxJtoG2w">
     <ns3:title>Some content to create the test script update5¬†(description)</ns3:title>
     <ns2:description>
       <div xmlns="http://www.w3.org/1999/xhtml">
         <div dir="ltr">
           <p dir="ltr">Some content to create the test script update5¬†(description)</p>
         </div>
       </div>
     </ns2:description>
     <ns2:comment>&amp;nbsp;</ns2:comment>
   </ns2:step>
   <ns2:step stepIndex="2" ns6:type="execution" ns7:about="https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29/executionscript/urn:com.ibm.rqm:executionscript:171?step=_0kqkkDlDEemQpdPxJtoG2w">
     <ns3:title>Some additional (second) step update5¬†(description)</ns3:title>
     <ns2:description>
       <div xmlns="http://www.w3.org/1999/xhtml">
         <div dir="ltr">Some additional (second) step update5¬†(description)</div>
       </div>
     </ns2:description>
     <ns2:comment>&amp;nbsp;</ns2:comment>
   </ns2:step>
 </ns2:steps>
 <ns6:type>Manual</ns6:type>
 <ns2:component href="https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29/component/_U_YxoCopEemrUIOJqS244w"/>
 <ns2:template href="https://xxx.xxx.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/YYY+YYY+YYY+Development+%28Quality+Management%29/template/manualtestscript/com.ibm.rqm.planning.templates.manualtestscript.template_1551129472752"/>
 <ns2:artifactAttributes>
   <ns2:artifactAttribute>
     <ns2:predefinedAttributeId>com.ibm.rqm.planning.common.manualtestscript.step.description</ns2:predefinedAttributeId>
   </ns2:artifactAttribute>
   <ns2:artifactAttribute>
     <ns2:predefinedAttributeId>com.ibm.rqm.planning.common.manualtestscript.step.expectedresult</ns2:predefinedAttributeId>
   </ns2:artifactAttribute>
   <ns2:artifactAttribute>
     <ns2:predefinedAttributeId>com.ibm.rqm.planning.common.manualtestscript.step.attachementsandlinks</ns2:predefinedAttributeId>
   </ns2:artifactAttribute>
 </ns2:artifactAttributes>
 <com.ibm.rqm.planning.editor.section.dynamicSection_1551129509001 xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" extensionDisplayName="RichTextSection">
   <div xmlns="http://www.w3.org/1999/xhtml">Some additional info update 5</div>
 </com.ibm.rqm.planning.editor.section.dynamicSection_1551129509001>
 <com.ibm.rqm.planning.editor.section.dynamicGridSection_1551129526022 xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" extensionDisplayName="GridSection" type="GRID">{"columnNames":["Column 1","Column 2"],"value":[[["A5"],["B5"]]]}</com.ibm.rqm.planning.editor.section.dynamicGridSection_1551129526022>
</ns2:executionscript>

One answer



permanent link
Paul Slauenwhite (8.4k12) | answered Feb 27 '19, 6:26 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

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.