It's all about the answers!

Ask a question

How to create TestCaseExecutionRecord and TestResult in RQM through OSLC?

Anurag Patel (21568) | asked Dec 08 '17, 2:37 a.m.

 Hi all,

I am trying to create TCER and TestResults  in RQM through OSLC. I have successfully created TestCase in RQM with same approach. But not able to create TCER and TestResult.

Following is my code:
if (client.login() == HttpStatus.SC_OK) 

//STEP 4: Get the URL of the OSLC QualityManagement catalog
String catalogUrl = helper.getCatalogUrl();

//STEP 5: Find the OSLC Service Provider for the project area we want to work with
String serviceProviderUrl = client.lookupServiceProviderUrl(catalogUrl, projectArea);

//STEP 6: Get the Query Capabilities URL so that we can run some OSLC queries
String queryCapability = client.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2,OSLCConstants.QM_TEST_RESULT_QUERY);
// queryCapability = jazzClient.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2, OSLCConstants.QM_TEST_EXECUTION_RECORD_QUERY);
OslcQueryParameters queryParams = new OslcQueryParameters();
// queryCapability = jazzClient.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2, OSLCConstants.QM_TEST_EXECUTION_RECORD_QUERY);
TestResult testResult = new TestResult();
testResult.setProducedByTestExecutionRecord(new Link());
//testResult.setReportsOnTestCase(" ");

//testcase.addTestsChangeRequest(new Link(new URI("http://cmprovider/changerequest/1"), "Implement accessibility in Pet Store application"));

//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,

//Create the test case
ClientResponse creationResponse = client.createResource(
testcaseCreation, testResult,
if (creationResponse.getStatusCode() != HttpStatus.SC_CREATED) {
System.err.println("ERROR: Could not create the test case (status " + creationResponse.getStatusCode() + ")\n");

String testcaseLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION);
System.out.println("Test Case created at location " + testcaseLocation);

//Get the test case from the service provider and update its title property

One answer

permanent link
abhishek gour (3812) | answered Dec 11 '17, 9:14 a.m.
edited Dec 11 '17, 9:15 a.m.

Hi Anurag, 

Are you able to create Test Result or TCER ( TestExecutionRecord) via a POSTER tool? ( manually configured XML to create the test result? ). 

One suggestion to avoid any missing field is - try to do a GET on the Test Result. And then do a PUT with almost all types of properties which you got from that GET. 

Also , it would be easier if you could provide XML which you are sending to create TEST Result. May be some field from that XML is missing. 

How ever may be you are just trying to create Test Result in reference with TCER you have created. I can see there is a Test Case created in your Test Result creation request, but there is NO TCER reference based on that test case. 
Please note that Test Result would get created in reference with a TCER ( which again is dependent on Test Case ). 

<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #3933ff} </style>

Anurag Patel commented Dec 11 '17, 12:13 p.m.

Thanks @Abhishek gour ...I am not sending xml when creating Test Result and TCER. I am new to RQM OSLC technology so does not have any idea how to create both. I simply replace TestCaseExecutionRecord and Test Result in above code snippet. Please provide steps to create to TCER and Test Results. I just follow same approach like creating TestCase. Is this is right approach?

Donald Nong commented Dec 11 '17, 10:10 p.m.

Anurag, I suggest you read through the API reference document (, and verify your workflow using a REST client such as POSTER first. It can be done much more easily and would help you understand the Lyo code that you try to reuse.

Anurag Patel commented Jan 08 '18, 6:35 a.m.

 Hi @Donald Nong I read this document but can not get clear idea about TCER creation. Please help me for mandatory fileds that I need to pass in request. 

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.