It's all about the answers!

Ask a question

Create new Execution Result in RQM using Rest API


Sudarshan Mishra (122) | asked Jun 05 '12, 6:27 a.m.
I am also facing similar issue. What we do is we go and create Execution Record for all test cases that needs to be executed on a build. Please note that while creating execution record we don't create the Execution Result, to so initially all the test cases as Not Run. Now We run our Automation framework which executes the test cases and updates the execution result in RQM.

We use rest API to create Execution result.
First issue is while setting the Testplan, Testcase, TestPhase etc. executionResult.setTestcase(testcase)
here it asks for a testcase instance of ...bind.ExecutionResult.Testcase class.
and I am unable to get the reference of this inner class. If I try to get the reference from the Test Execution Record it gives ...bind.Executionworkitem.Testcase
similarly for testplan and Testphase.
If any one can tell how to get reference of testcase, testphase, testplan without using another Execution Result.

Second way What I tried is
Created a Execution Record with using same testplan, testphase and testenvironment
In this case as we know RQM will not create a new Execution record instaed it will create a Execution Result and attach this to same execution record which has all 3 parameters(testplan, testphase, testenvironment) same.
In this case I get an error "Redirect requested but followRedirects is disabled."

I tried to setfollowRedirects on IRQMRestClient but didn't find any method how to do this.
If anyone can help me in any of these 2 issues, it will be highly appreciated.

4 answers



permanent link
Paul Slauenwhite (8.4k12) | answered Jun 05 '12, 12:52 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
1) You need to create a new instance of Executionresult.Testcase and set the properties.  For example:

Executionresult.Testcase jaxbTestcase = new Executionresult.Testcase();
jaxbTestcase.setXXX();

jaxbExecutionresult.setTestCase(jaxbTestcase);

2) You need to disable follow redirects on the HTTP method before execution:

putOrPostHttpMethod.setFollowRedirects(false);

//Execute HTTP method...

To resolve the execution work item URL:

if(putOrPostHttpMethod.getStatusCode() == HttpURLConnection.HTTP_MOVED_TEMP){
    String location = putOrPostHttpMethod.getResponseHeader(HTTP_HEADER_LOCATION).getValue();
}

Comments
Sudarshan Mishra commented Jun 07 '12, 6:35 a.m.

Thanks Paul for your reply

When I post, it gives error "Test Case Execution Record is not provided" I am unable to get the href of Executionworkitem to do something like this Executionresult.Executionworkitem execResWI = new Executionresult.Executionworkitem(); execResWI.setHref("I need href of Execution record to set here"); executionResult.setExecutionworkitem(execResWI );

I don't have any existing ExecutionResult. I have only Execution record.


permanent link
Sudarshan Mishra (122) | answered Jun 07 '12, 7:52 a.m.
I created a new Executionresult.Executionworkitem
created a href based on webId of Executionworkitem that I want to update and set that in newly created Executionresult
after that post the Executionresult
I get Null pointer exception from post method, but execution result is created.
If any one has any idea why Null pointer is coming, which parameter I need to set to remove this.

permanent link
Paul Slauenwhite (8.4k12) | answered Jun 07 '12, 12:28 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
The best practice is the Tip in https://jazz.net/wiki/bin/view/Main/RqmApi#Create after creating a few sample resources in the RQM UI.

You'll need to post the NPE stack trace to determine the cause.

permanent link
DUm Dum (211) | answered Jan 09 '18, 1:24 p.m.

 Hi Sudarshan were you able to resolve your issue. If so please provide  sample code. We are alos trying to implement the same feature.


Thanks in advance

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.