How to add Testscript Steps in OSLC using REST API?
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
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
Do you have any other questions, please contact me.
Best regards,
Jean-Luc Johnson, Airbus Group.
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.