Is it possible to set up automation for XRay that adds Tests to my Test Plan?

Talsma_Dalan
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!
July 29, 2022

I currently have automation set up that creates a set of Tests when a label is placed on a Test Plan. However, I have to manually add the Tests to the Test Plan once they are created. Is there a way to automatically add Tests to a Test Plan? I am seeing the field "Tests associated with a Test Plan", but so far have been unsuccessful in making that field do anything.

1 answer

0 votes
Rawan Bardini
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.
July 29, 2022

Hi @Talsma_Dalan ,

To answer your question, from my understanding a Test Plan in Xray is best used to aggregate together many Test Executions, to provide a "single status bar" for all the Test Run Statuses (Passed/Failed, etc).

The guidance I have seen is always to add Test Executions to a Test Plan. This can be done from the Test Plan itself, or from within the Test Execution. 

Once a Test Execution is added to the Test Plan, then all of the Tests within the Test Execution are also automatically added to the Test Plan for you.

From the Test Plan it will just have a popup message saying they were automatically added. From the Test Execution there will be a prompt asking you to confirm you want to also add the Tests to the Test Plan.

That would be my recommendation, add Test Executions to the Test Plan, rather than trying to add Tests to a Test Plan.

You can also reference the Xray User Guide online for more information on the Xray hierarchy and structure along with intended usage. Link to Cloud User Guide

You can look up the server version if that's what you have.

Hope that helps! Thanks!

Talsma_Dalan
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!
July 29, 2022

Whether its adding the Tests to the Test Execution, or Adding the Test Executions to the Test Plan, I would still want to fully automate the process if possible. How within the automation would I achieve that? If I wanted the Tests to automatically attach to the Test Execution when they are created, is there an advanced field value change I can do with JSON to achieve this?

Antonio Gil Coto February 20, 2023

Hi @Talsma_Dalan I am looking for the very same solution to "how to add a test to a test set/test plan when a given label is set in the test". Have you got a solution? I was thinking about using the Xray API to do that but I didn't find a suitable endpoint. Maybe with the JIRA API we could have success ....

rajeswari saravanan November 16, 2023

Same thing I’m looking for!! Any suggestions for that.I tried post functions as well but add test is not as expected.Please suggest

joehardin
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 24, 2024

@Talsma_Dalan @Antonio Gil Coto @rajeswari saravanan the only way to do this is by using the xray API because the relationship you are referring to isn't actually a jira issue link relationship - it's a relationship on xray's custom objects. Jira automation can't touch those. 

See this excellent article on an example of how to call the xray api via jira automation: https://community.atlassian.com/t5/Automation-articles/Navigating-Test-Execution-Workflows-A-Beginner-s-Guide-to-Jira/ba-p/2606780

 

For your use case, you will need to incorporate this method from the xray API in place of the one in the example article linked above: https://xray.cloud.getxray.app/doc/graphql/addteststotestplan.doc.html

Like rajeswari saravanan likes this
rajeswari saravanan April 1, 2024

Thanks for the guidance @joehardin will have a look.

Suggest an answer

Log in or Sign up to answer