It's all about the answers!

Ask a question

Execution Result of a Test Case

Dylan Mansour (2113) | asked Aug 12 '16, 10:07 a.m.
 Hello everyone.  I am trying to pull the execution result of a test case and seem to be running into a problem.

I am using a test case QM to pull info on the test case.  I use a data source configuration on a feed schema to pull execution result data, but it doesn't seem to be pulling the info.

Are there any templates that achieve this goal?

Thank you,
Dylan Mansour

Accepted answer

permanent link
Subramanya Prasad Pilar (4.2k14) | answered Aug 12 '16, 1:54 p.m.
edited Aug 12 '16, 2:02 p.m.
Once you get the testcase URL, you can get executionworkitems filtered by testcase/@href. You may use the following Script Expression to configure new data source (_Execution Work Item Feed) :
var pos=identifier.indexOf(/testcase/); //Using testcase/identifier
var configURI=identifier.substring(0,pos);
configURI=configURI + "/executionworkitem?fields=feed/entry/content/executionworkitem[testcase/@href='" + identifier + "']/*"

You can then dynamically set feed/entry/content/executionworkitem/executionresult/href as the URI for another datasource (_Execution Result Details). executionresult/state/_value will give the execution results.

Note that, there can be multiple execution results. You can either print all or print the latest. If no execuition results found, you can print the state as "Not Executed".
ScreenSht - TemplateSample (Incomplete)
Dylan Mansour selected this answer as the correct answer

Dylan Mansour commented Aug 15 '16, 9:57 a.m.

 This is very helpful, thank you.  What is the query you use to configure your first data source?

Subramanya Prasad Pilar commented Aug 15 '16, 1:51 p.m. | edited Aug 15 '16, 1:52 p.m.

Since you already have testase details, you can derive the url (using Data Source Configuration element) for _Execution Work Item Feed using following Script Expression:
//identifier = testcase/identifier attribute from _testcaseDetails datasource
var pos=identifier.indexOf(/testcase/);
var configURI=identifier.substring(0,pos);
configURI=configURI + "/executionworkitem?fields=feed/entry/content/executionworkitem[testcase/@href='" + identifier + "']/*"

So all in all 4 data sources - start with a RQM feed url, get _testcaseDetails, then _Execution Work Item Feed and finally _Execution Result Details.

Dylan Mansour commented Aug 15 '16, 4:38 p.m.

 I finally have it pulling the url for each and every execution result; my javascript didn't parse it correctly so now I am working on that.  Thanks for the help!

Dylan Mansour commented Aug 17 '16, 10:45 a.m.
What JS would you use to parse this:

Subramanya Prasad Pilar commented Aug 17 '16, 12:25 p.m.

You can use any script expression. for example

var mystate = _value;
mystate = mystate.replace("","");
mystate = mystate.substr(0, 1).toUpperCase() + mystate.substr(1);

One other answer

permanent link
PASQUET Nathan (111) | answered Jun 27 '18, 4:31 a.m.

Hi there, i'm dealing with the same problem. I want to get my execution results from a specific test case but when i follow your steps, i can't execute it in RPE Launcher (the execution is aborted). I noticed that you did some intermediates step with affectations beteween your datasource configuration but i van't figure out why. Could you explain why ? Or even better, could you share your RPE template so i can read and understand all your steps ?


Your answer

Register or to post your answer.