It's all about the answers!

Ask a question

How to add Testscript Steps in OSLC using REST API?


Krisztina Mahr (613) | asked Sep 08 '14, 2:39 a.m.
edited Sep 08 '14, 2:41 a.m.
 Hello!

I'm trying to attach some Test script Steps to my Testcases in Rational Quality Management jazz Team Server. 
Until now, I was able to add Testcases and / or Test Scripts in the following way:

	//SCENARIO C:  RQM TestCase creation and update
TestCase testcase = new TestCase();
testcase.setTitle("Accessibility verification using a screen reader");
testcase.setDescription("This test case uses a screen reader application to ensure that the web browser content fully complies with accessibility standards");

//Get the Creation Factory URL for test cases so that we can create a test case
String testcaseCreation = client.lookupCreationFactory(
serviceProviderUrl, OSLCConstants.OSLC_QM_V2,
testcase.getRdfTypes()[0].toString());
//Create the test case
ClientResponse creationResponse = client.createResource(testcaseCreation, testcase,
OslcMediaType.APPLICATION_RDF_XML);
if (creationResponse.getStatusCode() != HttpServletResponse.SC_CREATED) {
System.err.println("ERROR: Could not create the test case (status " + creationResponse.getStatusCode() + ")\n");
System.err.println(creationResponse.getEntity(String.class));
System.exit(1);
}
creationResponse.consumeContent();
String testcaseLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION); https://eclipse.googlesource.com/lyo/org.eclipse.lyo.client/+/f0d73fa342dd95d18ff9cfd5bd0f8226d2eae3d5/org.eclipse.lyo.client.java.sample/src/main/java/org/eclipse/lyo/client/oslc/samples/RQMFormSample.java
I also need to add Test Script Steps. I've read some articles and some questions in this forum and I know, that I'd need to use the REST API.
But I don't know exactly how.
I've also found an article about REST API, but I'm not sure, if I'm trying to use the right one:
https://jazz.net/library/LearnItem.jsp?href=content/docs/web-ui-programming/web-ui-todo-rest.html
Is this the REST API, what I need? How can I use it? And how will I be able to create steps?

Could someone please help me?

Thanks,
Krisztina

2 answers



permanent link
Jean-Luc Johnson (8125) | answered Sep 08 '14, 6:43 a.m.
edited Sep 08 '14, 6:45 a.m.
You would need to post all the test scripts to the RQM as you have posted/created a new test case. Then you could update a given testcase with the list of related test script steps.

I recommend that you use the GIT repository at http://git.eclipse.org/c/lyo/org.eclipse.lyo.client.git/tree/org.eclipse.lyo.client.java.sample/src/main/java/org/eclipse/lyo/client/oslc/samples/RQMFormSample.java not the googlesource.
The  java class RQMFormSample.java also shows you how to update an existing artefact like a test case.

Features demonstrated in the RQMFormSample
 * - run an OLSC TestResult query and retrieve OSLC TestResults and de-serialize them as Java objects
 * - retrieve an OSLC TestResult and print it as XML
 * - create a new TestCase
 * - update an existing TestCase
You should be able to post new test script artefacts by replacing testcase with testscript in the RQMFormSample. Find the reference implementation of the testscript artefact at http://git.eclipse.org/c/lyo/org.eclipse.lyo.client.git/tree/org.eclipse.lyo.client.java/src/main/java/org/eclipse/lyo/client/oslc/resources/TestScript.java .

Do you have any other questions, please contact me.

Best regards,
Jean-Luc Johnson, Airbus Group.


permanent link
Jean-Luc Johnson (8125) | answered Sep 08 '14, 6:35 a.m.
Hi Krisztina,
First of all, the tutorial at  https://jazz.net/library/LearnItem.jsp?href=content/docs/web-ui-programming/web-ui-todo-rest.html is too old and I would say it is probably out of date. I would not recommend this way of integration.

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.