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
1 vote
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
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
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?
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?
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?
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
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
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
1 vote
showing 5 of 6
show 1 more comments