Automatically generate a jira bug ticket when a Xray test failed

Dalil Chablis February 12, 2021

Hello, I'm setting up an e2e test automation system on jira with the Xray plugin.
In short, when I perform my tests in my CI environment, I communicate the test results to jira via the Xray api, which generates a test execution.
I would like to know if it is possible to automatically generate a ticket bug in jira when one of the tests fails?

2 answers

2 accepted

0 votes
Answer accepted
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 23, 2021

Hi @Dalil Chablis 

 

If you are using a CI tool, you can make a script using REST API calls to create the Bug issue and link it to the Test Execution.

Use the Jira REST API to create the bug and use Xray REST API (add defect to Test Run).

If you need further help, please contact the Xray Support (http://xraysupport.xpand-it.com) so that we can request additional information and investigate further.

Kind regards,
Rogério Paiva [Xray Support Team]

0 votes
Answer accepted
Bill Sheboy
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.
February 12, 2021

Hi @Dalil Chablis  -- Welcome to the Atlassian Community!

I do not use that add-on tool, and I wonder if it can generate an incoming webhook to Jira.  If so, you could use that webhook trigger to fire an automation rule to create the defect:

https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/#Automationtriggers-Incomingwebhook

 

Best regards,

Bill

Dalil Chablis February 12, 2021

Hi @Bill Sheboy 

Thank you for your answer, I'm going to look on this side !

All the best,

Dalil

Like Bill Sheboy likes this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2021

Hi @Dalil Chablis,

@Bill Sheboy is right in that Web hooks are a great way to tackle this. When you said "communicate the test results to jira via the Xray api, which generates a test execution" how does this work out? Is the test execution an issue of some particular type or what happens?

Cheers,

Simeon.

Dalil Chablis February 15, 2021

Hi @Simmo

I perform my e2e tests using the cypress framework.
When I run the tests, I generate a json report that I send to jira through the Xray api.
And this generates an xray run-time ticket that contains my test results.

Cheers,

Dalil 

Like Ritik Banga likes this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 15, 2021

Hi @Dalil Chablis,

So, if the xray run-time ticket contains the test results in the description or a custom field you could try using the Advanced compare to see if they contain key words that a indicate a test has failed and, if so, create a bug ticket.

If not, webhooks would be the way to go.

Cheers,

Simeon. 

Ritik Banga March 2, 2022

Hi @Dalil Chablis 

Could you please help me for sending reports to X-ray using API

Dalil Chablis March 2, 2022

Hi @Ritik Banga,
If you are interested, I had made a documentation on how I set up my end-to-end test automation system.
However, this one is in French, so you will have to translate it (https://gitlab.com/dalil01/automatisation-test-e2e).
Feel free to consult it (https://docs.getxray.app/display/XRAY/REST+API).
If you have any questions, don't hesitate

Ritik Banga March 3, 2022

Thank you @Dalil Chablis 

Also one more thing have you figured out how to log defect automatically because I am struggling with the same.

Dalil Chablis March 3, 2022

One solution I found is to go through my json report in my code, get the bugs, then use the Jira api to create issues (https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-create-issue-7897248/). @Ritik Banga 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events