It's all about the answers!

Ask a question

Create a new RQM test case with OSLC


2
1
Nicola Carusi (281011) | asked May 22 '14, 12:11 p.m.
edited May 23 '14, 5:00 a.m. by Ralph Schoon (63.6k33646)

Hi,

I'm trying to create a TestCase usign OSLC.

These are the step that I'm following:

STEP 1

GET request to https://jazz.amsspa.it:9443/qm/rootservices.

What I get is the following:

...

<oslc_qm:qmServiceProviders

xmlns:oslc_qm="http://open-services.net/xmlns/qm/1.0/"

rdf:resource="https://jazz.amsspa.it:9443/qm/oslc_qm/catalog" />

...

STEP 2

GET request to https://jazz.amsspa.it:9443/qm/oslc_qm/catalog

What I get is the following:

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

<oslc_disc:ServiceProviderCatalog rdf:about="https://jazz.amsspa.it:9443/qm/oslc_qm/catalog" xmlns:jproc="http://jazz.net/xmlns/prod/jazz/process/1.0/" xmlns:oslc_qm="http://open-services.net/xmlns/qm/1.0/" xmlns:ns5="http://open-services.net/ns/qm#" xmlns="http://purl.org/dc/elements/1.1/" xmlns:ns8="http://jazz.net/ns/qm/rqm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/" xmlns:jpres="http://jazz.net/xmlns/prod/jazz/presentation/1.0/" xmlns:ns3="http://open-services.net/ns/core#" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:dc="http://purl.org/dc/terms/">

<dc:title>RQM Quality Management Service Provider Catalog</dc:title>

<oslc_disc:entry>

<oslc_disc:ServiceProvider>

<dc:title>Project Area Prova</dc:title>

<oslc_disc:details rdf:resource="https://jazz.amsspa.it:9443/qm/process/project-areas/_7jMxz8YsEeOl9adIPSWrPQ"/>

<oslc_disc:services rdf:resource="https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/services.xml"/>

<jproc:consumerRegistry rdf:resource="https://jazz.amsspa.it:9443/qm/process/project-areas/_7jMxz8YsEeOl9adIPSWrPQ/links"/>

</oslc_disc:ServiceProvider>

</oslc_disc:entry>

</oslc_disc:ServiceProviderCatalog>

STEP 3

GET Request to https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/services.xml

With the 3rd request I get the following response:

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

<oslc_qm:ServiceDescriptor xmlns:jproc="http://jazz.net/xmlns/prod/jazz/process/1.0/" xmlns:oslc_qm="http://open-services.net/xmlns/qm/1.0/" xmlns:ns5="http://open-services.net/ns/qm#" xmlns="http://purl.org/dc/elements/1.1/" xmlns:ns8="http://jazz.net/ns/qm/rqm#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/" xmlns:jpres="http://jazz.net/xmlns/prod/jazz/presentation/1.0/" xmlns:ns3="http://open-services.net/ns/core#" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:dc="http://purl.org/dc/terms/">

<dc:title>Project Area Prova Cate RQM</dc:title>

<dc:description>Project Area Prova Cate RQM</dc:description>

<oslc_qm:testplans oslc_qm:version="I20140205_1831">

<oslc_qm:home>

<dc:title>Test Plan Home</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/web/console/Project%20Area%20Prova%20Cate%20RQM#action=com.ibm.rqm.planning.home.actionDispatcher&amp;subAction=viewTestPlans</oslc_qm:url>

</oslc_qm:home>

<oslc_qm:factory>

<dc:title>Location for creation of Test Plans</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/resources/com.ibm.rqm.planning.VersionedTestPlan</oslc_qm:url>

</oslc_qm:factory>

<oslc_qm:simpleQuery>

<dc:title>Location for simple query of Test Plans</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/resources/com.ibm.rqm.planning.VersionedTestPlan</oslc_qm:url>

</oslc_qm:simpleQuery>

<oslc_qm:selectionDialog oslc_qm:hintHeight="510px" oslc_qm:hintWidth="750px" oslc_qm:default="true" calm:id="testplan">

<dc:title>Select Test Plan</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/_ajax-modules/com.ibm.rqm.oslc.TestPlanPicker?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ</oslc_qm:url>

</oslc_qm:selectionDialog>

<oslc_qm:creationDialog oslc_qm:hintHeight="250px" oslc_qm:hintWidth="530px" oslc_qm:default="true" calm:id="testplan">

<dc:title>Create New Test Plan (default)</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/_ajax-modules/com.ibm.rqm.oslc.NewTestPlanPicker?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ</oslc_qm:url>

</oslc_qm:creationDialog>

<oslc_qm:creationDialog oslc_qm:hintHeight="250px" oslc_qm:hintWidth="530px" oslc_qm:default="false" calm:id="testplan">

<dc:title>Create New Test Plan (pre-filled)</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.common.ICreationDialogService?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ&amp;pickerModule=com.ibm.rqm.oslc.NewTestPlanPicker</oslc_qm:url>

<oslc_qm:label>POST</oslc_qm:label>

</oslc_qm:creationDialog>

</oslc_qm:testplans>

<oslc_qm:testcases oslc_qm:version="I20140205_1831">

<oslc_qm:home>

<dc:title>Test Case Home</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/web/console/Project%20Area%20Prova%20Cate%20RQM#action=com.ibm.rqm.planning.home.actionDispatcher&amp;subAction=viewTestCases</oslc_qm:url>

</oslc_qm:home>

<oslc_qm:factory>

<dc:title>Location for creation of Test Cases</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/resources/com.ibm.rqm.planning.VersionedTestCase</oslc_qm:url>

</oslc_qm:factory>

<oslc_qm:simpleQuery>

<dc:title>Location for simple query of Test Cases</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/resources/com.ibm.rqm.planning.VersionedTestCase</oslc_qm:url>

</oslc_qm:simpleQuery>

<oslc_qm:selectionDialog oslc_qm:hintHeight="510px" oslc_qm:hintWidth="750px" oslc_qm:default="true" calm:id="testcase">

<dc:title>Select Test Case</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/_ajax-modules/com.ibm.rqm.oslc.TestCasePicker?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ</oslc_qm:url>

</oslc_qm:selectionDialog>

<oslc_qm:creationDialog oslc_qm:hintHeight="250px" oslc_qm:hintWidth="530px" oslc_qm:default="true" calm:id="testcase">

<dc:title>Create New Test Case (default)</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/_ajax-modules/com.ibm.rqm.oslc.NewTestCasePicker?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ</oslc_qm:url>

</oslc_qm:creationDialog>

<oslc_qm:creationDialog oslc_qm:hintHeight="250px" oslc_qm:hintWidth="530px" oslc_qm:default="false" calm:id="testcase">

<dc:title>Create New Test Case (pre-filled)</dc:title>

<oslc_qm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.common.ICreationDialogService?projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ&amp;pickerModule=com.ibm.rqm.oslc.NewTestCasePicker</oslc_qm:url>

<oslc_qm:label>POST</oslc_qm:label>

</oslc_qm:creationDialog>

<calm:filter calm:id="noTests">

<dc:title>No Tests Filter</dc:title>

<calm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.calm.common.ICalmFilterService/noTests</calm:url>

</calm:filter>

<calm:filter calm:id="successfulTests">

<dc:title>Successful Tests Filter</dc:title>

<calm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.calm.common.ICalmFilterService/successfulTests</calm:url>

</calm:filter>

<calm:filter calm:id="failingTests">

<dc:title>Failing Tests Filter</dc:title>

<calm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.calm.common.ICalmFilterService/failingTests</calm:url>

</calm:filter>

</oslc_qm:testcases>

<oslc_qm:executionresults oslc_qm:version="I20140205_1831">

<calm:filter calm:id="isCurrentAndBlocked">

<dc:title>Current and Blocked Filter</dc:title>

<calm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.calm.common.ICalmFilterService/isCurrentAndBlocked</calm:url>

</calm:filter>

</oslc_qm:executionresults>

<oslc_qm:executionrecords oslc_qm:version="I20140205_1831">

<calm:filter calm:id="lastTestResultFailing">

<dc:title>Last Test Result Failing Filter</dc:title>

<calm:url>https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.oslc.calm.common.ICalmFilterService/lastTestResultFailing</calm:url>

</calm:filter>

</oslc_qm:executionrecords>

</oslc_qm:ServiceDescriptor>

At this point of the process, I'm missing the following step!!

Can anyone help me?

Thank you

Nicola

7 answers



permanent link
Don Yang (7.7k21114139) | answered May 22 '14, 9:32 p.m.
edited May 22 '14, 9:33 p.m.
Nicola

Have you tried [“Cheat sheets” for creating test resources through REST APIs.] from
http://sleroyblog.wordpress.com/2013/04/09/querying-rqm-40-through-oslc-and-rest-api/

Thanks

permanent link
Canberk Akduygu (99237371) | answered May 23 '14, 2:27 a.m.
You might want to POST to those URI's:

Test Case: http://SERVERNAME:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTNAME/testcase/urn:com.ibm.rqm:testcase

Test Plan: http://SERVERNAME:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTNAME/testplan/urn:com.ibm.rqm:testplan

Project Name should be decoded by using URLEncoder.encode(projectname, HTTP.UTF_8)

In case you want to GET test case or plan, you need to GET those URI's

Test Case: http://SERVERNAME:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTNAME/testcase/urn:com.ibm.rqm:testcase:TESTCASEID

Test Plan: http://SERVERNAME:PORT/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/PROJECTNAME/testplan/urn:com.ibm.rqm:testplan:TESTPLANID

permanent link
Nicola Carusi (281011) | answered May 23 '14, 3:53 a.m.

Hi Camberk,

I'm trying your suggestions.

I'm trying to send a POST request to the following URL.

https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ/testcase/urn:com.ibm.rqm:testcase

Is the encoding of the Project Name correct or do I have to use

Project%20Area%20Prova%20Cate%20RQM instead of

projectAreaId=_7jMxz8YsEeOl9adIPSWrPQ?

Anyway, in both cases I'm getting from the server an empty string as response e no test cases are created.

With a POST request, can I send an XML file?

Thank you!


Comments
Canberk Akduygu commented May 23 '14, 4:51 a.m.

You need to use the encoded project name.

If your project name is 'Test project' it should be something like 'Test%20%Project'.

Just use URLEncoder.encode(projectname, HTTP.UTF_8)


permanent link
Nicola Carusi (281011) | answered May 23 '14, 4:42 a.m.

Hi Don,

following your link, it seems that the URL to be used to create a new test case is

https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE+Banking+%28Quality+Management%29/testcase

I'm trying with it, but I'm always getting an empty string from the server.

Probably I'm doing something wrong in the request..I don't know!


Comments
Canberk Akduygu commented May 23 '14, 4:52 a.m. | edited May 23 '14, 4:53 a.m.

add urn:com.ibm.rqm:testcase add the end of the URI. so your URI be like
https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE+Banking+%28Quality+Management%29/testcase/urn:com.ibm.rqm:testcase

My example has the right URI.


Nicola Carusi commented May 23 '14, 5:18 a.m.

Ok, I'm using a PHP script like the following one.

$content="xml string of the test case";

$url = "https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project%20Area%20Prova%20Cate%20RQM/testcase/urn:com.ibm.rqm:testcase";

$headers = Array('Accept: application/xml', 'OSLC-Core-Version: 2.0', 'Content-Type: application/rdf+xml');

$ch= curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_POST, TRUE);

curl_setopt($ch, CURLOPT_POSTFIELDS, "$content");

$response = curl_exec($ch);

The variable $response is set to TRUE by the curl_exec function, which means that the request is correctly done. But if I go on the server there is no new test case!!

Where is the mistake?




permanent link
Nicola Carusi (281011) | answered May 23 '14, 5:26 a.m.

I'm trying to analyze my request with an HTTP analyzer.

In the response header there is:

X-com-ibm-team-repository-web-auth-msg: authrequired.

Do I have to send also my username and password?

How can I do that?


Comments
Canberk Akduygu commented May 23 '14, 6:58 a.m.

You should first login to the application as anonymous access is not possible.
https://jazz.net/wiki/bin/view/Main/OSLCWorkshopDownload you can find java example of how to login to the JazzTeamServer.


permanent link
Nicola Carusi (281011) | answered May 23 '14, 8:34 a.m.

Hi Camberk,

I'm trying with RESTClient of Firefox.

I correctly created a TestCase with an XML file and now I'm trying with the RDF.

I'm performing this request:

POST

url: https://jazz.amsspa.it:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project%20Area%20Prova%20Cate%20RQM/testcase/urn:com.ibm.rqm:testcase

Headers:

Accept: application/rdf+xml

OSLC-Core-Version: 2.0

X-Jazz-CSRF-Prevent: 00002mT2kZHJgS67Jd5U-2PPFkU:-1

Content-Type: application/rdf+xml

In the Body i'm putting this:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rqm_auto="http://jazz.net/ns/auto/rqm#"
xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/"
xmlns:rqm_qm="http://jazz.net/ns/qm/rqm#"
xmlns:acp="http://jazz.net/ns/acp#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:oslc_auto="http://open-services.net/ns/auto#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_qm="http://open-services.net/ns/qm#"
xmlns:bp="http://open-services.net/ns/basicProfile#" >
<rdf:Description rdf:about="">
 <dcterms:contributor rdf:resource="https://jazz.amsspa.it:9443/jts/users/ncarusi"/>
 <rdf:type rdf:resource="http://open-services.net/ns/qm#TestCase"/>
 <dcterms:title rdf:datatype="http://dwa.amsspa.it:8080/dwa/rm/urn:rational::1-4d0f3e3743d957fd-O-31-000031ab"/>
 <dcterms:creator rdf:resource="https://jazz.amsspa.it:9443/jts/users/ncarusi"/>
 <acp:accessControl rdf:resource="https://jazz.amsspa.it:9443/qm/oslc_qm/accessControl/_7jMxz8YsEeOl9adIPSWrPQ"/>
 <oslc:serviceProvider rdf:resource="https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/services.xml"/>
 <dcterms:created rdf:datatype=">http://www.w3.org/2001/XMLSchema#string">TC3_TS003_Description</dcterms:description>
 <oslc:instanceShape rdf:resource="https://jazz.amsspa.it:9443/qm/oslc_qm/contexts/_7jMxz8YsEeOl9adIPSWrPQ/shape/resource/com.ibm.rqm.planning.VersionedTestCase"/>
</rdf:Description>
</rdf:RDF>

I'm getting the response 400 Bad request: The uploaded content does not consist of well-formed XML or does not match the XML schema for testcase

I cannot understand what is wrong in the content.

Any suggestion?

Thank you


Comments
Donald Nong commented Jul 24 '14, 10:00 p.m.

If you get complaints about a malformed XML content, try to use the XML response of an existing test case as a template. Also, IE can do a fine job when verifying the format of an XML file.


permanent link
Canberk Akduygu (99237371) | answered Jul 24 '14, 8:00 a.m.
Hello,

I am trying to set owner of a test plan during test plan creation by adding
<ns5:owner ns1:resource="https://wat01ibmclm.int.teb.com.tr:9443/jts/resource/itemName/com.ibm.team.repository.Contributor/P21885">P21885</ns5:owner> line to my xml.

test Plan is created but its owner is always the creator.

Is there a way to set owner via REST API?

Comments
Donald Nong commented Jul 24 '14, 9:57 p.m.

That should be the right way since it works for me with RQM 4.0.6.


Canberk Akduygu commented Jul 25 '14, 2:14 a.m.

I also cannot set Categories.
That's strange, it's not giving me any error.
I send PUT request to https://SERVER:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestYonetimi1387280314149%28Quality+Management%29/testplan/urn:com.ibm.rqm:testplan URI. Isn't it right one?


Canberk Akduygu commented Jul 25 '14, 2:52 a.m.

I found the problem.

xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/"
<ns5:owner

I had to use ns5 tag but I worngfullt put ns2. That's why it wasnt accepting my owner.

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.