It's all about the answers!

Ask a question

how to link/add testcases to test suites with rest api (xml template)


durga sankar (133) | asked Apr 19 '21, 11:49 a.m.

 <?xml version="1.0" encoding="UTF-8"?>

<ns2:testcase xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/"
<ns4:title>TestCase</ns4:title>
<ns4:description>Test Case Creation through Rest API </ns4:description>
<ns5:state>com.ibm.rqm.planning.common.new</ns5:state>
<ns2:variables/>
<ns2:scriptStepCount>1</ns2:scriptStepCount>
<ns2:remotescript href="https://<localhost>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_joJ8cP-MEeeJ27a7PHh-Ow/remotescript/urn:com.ibm.rqm:remotescript:20194" />
<ns2:template href="https://<localhost>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_M_xHQMoFEeqQKPfhtQ8FFw/template/testcase/com.ibm.rqm.planning.templates.testcase.default"/>
</ns2:testcase>


what attribute should i need to add or what i need to do to link testsuite and test script?

Accepted answer


permanent link
Monika Rajput (2412) | answered Apr 23 '21, 10:05 a.m.

Hi Durga,


To link test script to test suite, you need to enable a property.
Go to Administration -> Manage Project Properties -> Test Case/Suite Preferences -> Use test scripts in test suites
Enable the property Use test scripts in test suites by clicking on the checkbox. Once saved, refresh the page.

Now you can add test script to test suite using web UI or REST API too.
You can also set <ns2:scriptExecution>true</ns2:scriptExecution> in REST PUT Body to mark the suite for script execution.

Thanks,
Monika Rajput

durga sankar selected this answer as the correct answer

Comments
durga sankar commented Apr 26 '21, 12:24 a.m.

hello Monika,

     Actually i am using python for automate the process of TC,TestScript and suite creation and update. with "<ns2:remotescript href="<link>" />" i am able to link TC with testscript. But i need to add multiple testcases to testsuite. so how can i pass test suite (already created) link to test case xml template. with which tag ? i tried "<ns2:testsuite " and few others from jazz site. but not got any result. or else how can i link testcase(already created) to test suite with which tag and namespace?


Monika Rajput commented Apr 27 '21, 2:12 a.m.

 Hi,


To add test cases to test suite, you can use the following syntax in the Test Suite PUT XML body :
<ns2:suiteelements>
        <ns2:suiteelement elementindex="0">
            <ns2:testcase href="https://<host>:<port>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_area_alias>/testcase/urn:com.ibm.rqm:testcase:<testcase_web_id>"/>
        </ns2:suiteelement>
</ns2:suiteelements>


durga sankar commented May 20 '21, 4:12 a.m.

thank you... for the help monika 

Your answer


Register or to post your answer.