How to create TestCaseExecutionRecord and TestResult in RQM through OSLC?
![]() 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);
System.out.println(queryCapability.isEmpty());
OslcQueryParameters queryParams = new OslcQueryParameters();
// queryCapability = jazzClient.lookupQueryCapability(serviceProviderUrl, OSLCConstants.OSLC_QM_V2, OSLCConstants.QM_TEST_EXECUTION_RECORD_QUERY);
System.out.println(queryCapability.isEmpty());
TestResult testResult = new TestResult();
testResult.setTitle("summary");
testResult.setStatus("state_id");
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,
testResult.getRdfTypes()[0].toString());
//Create the test case
ClientResponse creationResponse = client.createResource(
testcaseCreation, testResult,
OslcMediaType.APPLICATION_RDF_XML);
if (creationResponse.getStatusCode() != HttpStatus.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);
System.out.println("Test Case created at location " + testcaseLocation);
//Get the test case from the service provider and update its title property
}
|
One answer
![]() 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 ).
Thanks,
Abhishek.
Comments 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? Anurag, I suggest you read through the API reference document (
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
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.