RQM REST API for Creating Test case
I am using following xml and java code for Creating of TC in RQM, but unable to create the TC, Please suggest me if anyone have the solution
<?xml version="1.0" encoding="UTF-8"?>
<testcase xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1">
<ns4:title>RFT SaiKiran Test Case</ns4:title>
<ns4:description>Hi, All Test Case Creation through RFT, by using RQM Rest API</ns4:description>
<ns5:state>com.ibm.rqm.planning.common.new</ns5:state>
<weight>100</weight>
<category term="AUTO" value="No"/>
<category term="Priority" value="3\-Normal"/>
<category term="Source" value="Mainframe"/>
<category term="System" value="Window"/>
<category term="Subsystem" value="Member"/>
<category term="TC / Usage" value="New"/>
<category term="Test / Cycle" value="Release"/>
<category term="Test / Level" value="System / Integration / Test"/>
<category term="Test / Type" value="SIT"/>
<variables/>
<testscript href="https://MyRQM:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/WAW_Refactoring/testscript/urn:com.ibm.rqm:testscript:256"/>
<com.ibm.rqm.planning.editor.section.testCaseDesign extensionDisplayName="RFT_RQM_REST_API">
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1"/>
</com.ibm.rqm.planning.editor.section.testCaseDesign>
</testcase>;
Java Code
String username= "AB04206";
String password= "Something";
public void testMain(Object[] args) throws IOException
{
try{
URL url = new URL("https://MyRQM:9443/jazz");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
String userpass = username + ":" + password;
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes());
conn.setRequestProperty ("Authorization", basicAuth);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type","application/xml");
OutputStreamWriter infWebSvcReqWriter = new OutputStreamWriter(conn.getOutputStream());
String infWebSvcRequestMessage = FileOps.readFile("C:\\CED_TestAutomation\\CED\\cedSource\\cedUtils\\RQMTC_Creation.xml");
infWebSvcReqWriter.write(infWebSvcRequestMessage);
infWebSvcReqWriter.flush();
BufferedReader infWebSvcReplyReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String infWebSvcReplyString = "";
while ((line = infWebSvcReplyReader.readLine()) != null) {
infWebSvcReplyString = infWebSvcReplyString.concat(line);
}
infWebSvcReqWriter.close();
infWebSvcReplyReader.close();
conn.disconnect();
System.out.println(infWebSvcReplyString);
}catch(Exception e){
System.out.println("here...");
}
}
Server Response
<!DOCTYPE html>
<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<title>
</title>
<link type="text/css" rel="stylesheet" href="/jazz/web/_style/?include=A~&etag=uGpiZTEU_en_US&_proxyURL=%2Fjazz">
<link rel="shortcut icon" href="/jazz/web/net.jazz.ajax/jazz.ico">
<style type="text/css">#net-jazz-ajax-NoScriptMessage { width: 100%; color: #D0D0D0; font-size: 2em; text-align: center; position: absolute; top: 1%; z-index: 999;}</style>
</head>
<body class="tundra"> <noscript>
<div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div>
</noscript>
<div id="net-jazz-ajax-InitialLoadMessage">Loading...</div>
<div id="net-jazz-ajax-WorkbenchRoot"></div>
<script type="text/javascript">
djConfig = { isDebug: false, usePlainJson: true, baseUrl: "/jazz/web/dojo/", locale: "en-us", localizationComplete: true };
/*null*/ net = {jazz: {ajax: {}}}; net.jazz.ajax._contextRoot = "/jazz"; net.jazz.ajax._webuiPrefix = "/web/"; </script> <script type="text/javascript" src="/jazz/web/_js/?include=A~&etag=uGpiZTEU_en_US">
</script> <script type="text/javascript"> /* <![CDATA[ */ dojo.getObject('jazz.core.loader', true)._loaded=['A'];net.jazz.ajax._rootServices = 'https://vaathmr1149.wellpoint.com:9443/jazz/rootservices';net.jazz.ajax._storageService = 'https://vaathmr1149.wellpoint.com:9443/jazz/storage';net.jazz.ajax._queryService = 'https://vaathmr1149.wellpoint.com:9443/jazz/query';net.jazz.ajax._infoCenterRoot = 'https://vaathmr1149.wellpoint.com:9443/jazz/../clmhelp';net.jazz.ajax._oauthRealmName = 'Jazz';net.jazz.ajax._viewletServiceRoot = 'https://vaathmr1149.wellpoint.com:9443/jazz';net.jazz.ajax._viewletWebUIRoot = 'https://vaathmr1149.wellpoint.com:9443/jazz';net.jazz.ajax._hasLocalRepository = true;net.jazz.ajax._proxyLegacyMode = false;net.jazz.ajax._oauthDomains = ['https://vaathmr1149.wellpoint.com:9443/jazz/'];net.jazz.ajax._friendDomains = ['http://vaathmr1136:12080/cqweb/oslc/repo/WLPRD/','http://vaathmr1136:12080/cqweb/oslc/repo/7.1.1_PROD/','https://va10puvras001.wellpoint.com:9443/jts/','https://va10puvrtc001.wellpoint.com:9443/jazz/','https://va10puvrqm002.wellpoint.com:9443/jazz/','https://va10puvrqm001.wellpoint.com:9443/jazz/']; /* ]]> */ </script> <script type="text/javascript"> /* <![CDATA[ */ dojo.addOnLoad( function() { net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired"); }); /* ]]> */ </script>
</body>
</html>
|
7 answers
Check the URL you are POST-ing to. According to the RQM API you need to use the singleProjectFeedURL . To troubleshoot further, I would first get this working using Poster.
Comments
SaiKiran Cheemakurthi
commented Mar 11 '13, 5:26 p.m.
Brian,
thank you so much for recommendation, I will try adding the singleProjectFeedURL.
Will you please share sample xml for creating TC, if you have one?
Thanks,
Sai
1
Brian Fleming
commented Mar 11 '13, 8:09 p.m.
Using Poster, perform a GET on an existing test case to get sample xml. Your testscript URL looks fine. The singleProjectFeedURL for testcases (what you should set your url variable to) would be: https://MyRQM:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/WAW_Refactoring/testcase +1 on Brian's answer.
|
<testscript href="https:/MyRQM:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/WAW_Refactoring/testscript/urn:com.ibm.rqm:testscript:256"/>
Brain,
I am using the Integration Service in my XML, please review it
Sai
|
A couple of things:
1) You are not authenticating with the RQM server. I would suggest using the HTTP client in the RQM URL Utility or RQM Copy Utility source. 2) Your test script URL contains entity references: https:/MyRQM:9443/jazz/service<b>/com.ibm.rqm.integration.service.IIntegrationService</b>/resources/WAW_Refactoring/testscript/urn:com.ibm.rqm:testscript:256 Comments
SaiKiran Cheemakurthi
commented Mar 13 '13, 2:35 p.m.
Paul,
Now I am able to connect RQM server, I am using the RQM URL Utility, however still unable to create TC or TCER throu program. Always getting error 400 or 500 or 501. Is there any way will you please provide sample XML file for creating TC and TCER. I am unable to follow the instructions API document and creating XML file
Any help you provided will be highly helpful for my job
Thanks,
Sai
Hi Sai,
|
Hello,
I was able to create my test cases via Rest api but I need to obtain the identifier of those test cases so I can link them to the test plan. When I post xml representation of my test case, I only got HTTP 201 nothing more. Could you help me? Comments 1
The Content-Location response header will contain the ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#Create).
Canberk Akduygu
commented Dec 19 '13, 2:16 a.m.
After posting the question I found out my response by myself. I was looking at the wrong side :)
Thank you for quick answer also.
|
Hello,
I am trying to put a value to Categories while creating the Test Plan or Test Case. I added "<ns4:category value=\"Unit Test\" term=\"Test Phase\"/>" to my TestPlan xml but Categorie is ot set after the execution. Is there any restriction on some field like Categories,owner,etc? Comments
Paul Slauenwhite
commented Jul 24 '14, 8:53 a.m.
| edited Jul 24 '14, 8:54 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Try:
Canberk Akduygu
commented Jul 24 '14, 9:04 a.m.
I gave all the permissions to my user in Test Plan Permissions.
I guess jazz.net editor corrupted my xml value. I have <ns4:category value=\"Unit Test\" term=\"Test Phase\"/> this in mycode snippet.
Is there anything in the HTTP response content and/or RQM logs?
|
I sent PUT request to https://wat01ibmclm.int.teb.com.tr:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan
Test Plan is created. I got HTTP 201 message. Logs are: 2014-07-24 17:01:06,644 [WebContainer : 1 @@ 17:01 Jazz_Report_User /qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan] WARN com.ibm.rqm.integration.service - IntegrationService:handleRequest AQXIN2512W The request URI contains invalid characters. In the request URI, resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan, this segment is invalid: urn:com.ibm.rqm:testplan. 2014-07-24 17:01:06,924 [WebContainer : 1 @@ 17:01 Jazz_Report_User /qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%2528Quality%2BManagement%2529/testplan/urn:com.ibm.rqm:testplan] WARN com.ibm.rqm.planning - POST with id is improper usage; please do not provide the known id Comments You cannot not use an internal ID on a PUT request (see https://jazz.net/wiki/bin/view/Main/RqmApi#Internal_ID). In this case, the invalid ID is ignored and a generated ID is used.
"urn:com.ibm.rqm:testplan" is an internal id?
If so which uri do i need to use to make a put request? Also my request creates the test plan in project area. It only dont set the owner and category.
Sorry if i misinterpret what you said.
Canberk Akduygu
commented Jul 25 '14, 2:50 a.m.
I found the problem.
1
Good catch. Namespace prefixes can sometimes be tricky. I would have assumed an error/warning would have been logged in the RQM log.
Canberk Akduygu
commented Jul 30 '14, 6:15 a.m.
If I dont use urn:com.ibm.rqm:testplan I cannot create anything.
Please read https://jazz.net/wiki/bin/view/Main/RqmApi#id.
showing 5 of 6
show 1 more comments
|
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.