Automation rule for Jira/Xray: Add field values from test execution to a defect created from this

Daniela Maubach July 26, 2024

Hello everyone, 
 

our situation:
We use Xray/Jira DC and cannot make any changes to the fields outside of the Xray issue types.
 

If a defect is created from a test execution/test run, we are therefore missing the informations of the field "testenvironments".

 

So we want to add the value of the field "testenvironments" (labels, issue Test Execution) to the environment field (freetext, defect) when a defect is created from a test run.
 

Does anyone have any ideas or tips for a suitable automation rule?

1 answer

0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2024

Hi @Daniela Maubach - welcome to the community,

is there any characteristic that uniquely identifies a defect created from an execution (like a special linking or so)?

This would be needed to specify the trigger and consition for an A4J rule.

Best
Stefan 

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 1, 2024

Hi @Daniela Maubach 

There is an option in xray settings that specifies that a defect created out of an execution is linked to the test execution (i tested this, it´s set with the created link type).

Provided that this setting is set and the issue link is set when a defect is created out of a test run - this can be done as this would be the only trigger that comes to my mind.

Nevertheless, it was a tough task to find the solution.

The field "Test Environments" is not a native Jira field therefore it cannot be fetched directly via field actions or smart values in Automation. Therefore it´s necessary to call the graphql api to fetch this information.

 

Trigger:

when - Issue linked, Types: Defect

image.png

 

I set the condition to check if the linked issue is a test execution to limit potential activations of the rule.

 

Then there is the tricky part of getting the field value of "Test Environments":

I call the xray graphql api with the query "getTestExecution" and ask for the testEnvironments information. I then store the response to a variable to use later on when editing the created defect (see screenshots):

image.png

image.png

 

To edit the correct a branch of type "Destination issue" is created. This will take the Defect into context and the actual edit action is made in the created/linked defect issue (i just wrote the information into the description field, you just need to change the field regarding your requirement):

image.png

image.png

 

I tested this rule in my system and it did the job.

Hope I could give some helpful input.

 

Best
Stefan

Daniela Maubach August 1, 2024

Hello Stefan,

I'm currently heavily involved in a release.

Thank you very much for your comments, time and thoughts!

I won't be able to test it until next week but will let you know as soon as possible.

I wish you a wonderful weekend!

Daniela

Like Stefan Salzl likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 2, 2024

Hi @Daniela Maubach 

Thanks for your kind feedback and letting us know even though I´m sure you have little time for this in between a release 🙈🥵 great communication skills - I highly appreciate 👌🏼🙏🏼

deep dive and give it a shot whenever possible and just let us know if it´s working or if there are any further questions.

Best
Stefan

Like Daniela Maubach likes this
Daniela Maubach August 7, 2024

Hey,

it's me again :)

Unfortunately, I can't try out the solution with a webhook because we don't allow this in my company.

Now I’m waiting for the person responsible for Xray to come back from vacation.
We will then work through our options again, including your solution.

I'm very happy that you showed me this solution and explained where the fundamental problem with this automation rule lies!
The number of possibilities in Jira are simply incredible. I was aware of this from the beginning, but it becomes clearer with every hour of more in-depth induction.It's good that there are people like you!

Thank you very much for your effort!

Daniela

Like Stefan Salzl likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 7, 2024

Hey Daniela,

Thanks for the flowers. I´m really happy that I could give some good examples/insights and also good explanations. Thanks for that flattering feedback. 

Unfortunately I don´t see any other possibility than the api call to get the "Test Environments" field´s value. Hope you can manage to get this working.

I´m looking forward to your answer after you go through the solution with your colleague.

Best
Stefan

Like Daniela Maubach likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2024

Hi @Daniela Maubach 

Any updates on this issue?

Best
Stefan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events