Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to display Last Test Execution details on Test execution report at Test Level

Tula.Talluri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 9, 2022

Hello Experts i have a requirement to generate a test execution report for a single Test using XRAY document generator template.

My project setup is as below.

Project Name - Test XRAY

Requirement  -  XRAY - Test Req 1 (this is linked to both tests/ test cases)

Tests / Test Cases created to test this requirement - XRAY Test A,  XRAY Test B.

I have executed XRAY Test A and XRAY Test B three times with test environments field set to PROJ_TEST, so three execution references are generated i.e XRAY Test Exec Ref 1 (FAILED), XRAY Test Exec Ref 2(PASSED) and XRAY Test Exec Ref 3 (PASSED).

I have generated Test Execution Report (at Test/Test Case Level) for XRAY Test A using default XRAY test execution template - 'Test Execution Advanced  with Cover page'. The report is showing the details of all three executions with Test Case reference instead of execution reference but i only need the last execution details. Is there a piece of code which can give me only last execution details along with Test Execution reference instead of Test case details. i.e i am looking a report with below info. I have included the code that i am using to generate the report.

 

Last Execution Ref -       XRAY Test Exec Ref 3 (Currently report is showing Test Case reference - XRAY Test A)

#{for testruns}

${TestRuns[n].Key}

#{end}

 

Test Environment -    PROJ_TEST (this is not appearing on report) 

#{for testruns}

${TestRuns[n].Test Environments}

#{end}

 

Test Requirement - XRAY -     Test Req 1     (this is appearing Three time as a result of three executions and i only want to display once)

 

Test Requirements

#{for testruns}

#{for j=TestRuns[n].LinksCount|filter=%{'${TestRuns[n].Links[j].LinkType}'.equals('tests')}}

${TestRuns[n].Links[j].Key} - ${TestRuns[n].Links[j].Summary}

#{end}

#{end}

Started on - Today at 16:00hrs (this is working ok)

Finished on - Today at 18:00hrs (this is working ok)

Executed by - My name (this is working ok)

 

 

Please note that i could get the Last Execution details by generating the report from Execution screen but this report will show the details of all tests within that execution cycle. i.e  Tests  XRAY Test A and  XRAY Test B. Hence i cannot generate the report from Execution screen as sometimes these tests might not relevant to each other.

Any help is much appreciated.

Thanks in advance.

Tula.

 

1 answer

0 votes
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2022

Hi @Tula.Talluri 

That code will list all the executions.

If you need just the last execution you will need to compare "Finished On" dates and only print the information that belongs to the latest one.

You need to use a conditional block (https://confluence.getxray.app/display/public/XPORTERCLOUD/Conditional+Blocks) to compare the dates (${TestRuns[n].Finished On}) and store the values in variables until you compared all the executions values.

And in the end (after looping over every execution) print the content of the variables.

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

Tula.Talluri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 17, 2022

Thanks for your reply Rogerio. As i am not a developer i am struggling with using conditional blocks to get the required outcome. Is it possible for you to share the required code in this instance as an example so that i can use the same for my other requirements.

Thanks in advance.

Tula

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events