Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,257,426
Community Members
 
Community Events
164
Community Groups

Automatically generate a jira bug ticket when a Xray test failed

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

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

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

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 Feb 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.

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 Feb 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. 

Hi @Dalil Chablis 

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

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

Thank you @Dalil Chablis 

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

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
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

1,498 views 11 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you