Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,559,151
Community Members
 
Community Events
184
Community Groups

How to Import Cucumber Results to an Already-Existing Test/Test Execution

I am trying to use the Xray REST API to update test executions for Cucumber tests.

However, whenever I import results (either through the interface in Jira or with curl calls) a new Automated[Generic] test is created within the test execution, and the Automated[Cucumber] test that I am trying to update does not have its status updated.

If I run:

curl -H "Content-Type: application/json" -X GET -u username:password https://jira.ad.myurl.com/rest/raven/1.0/api/test?keys=DJS3-67

 I can find the correct test (key DJS3-67, id 63415). I associated a test execution with it (DJS3-70) as per this similar question  and downloaded my feature file from the execution, but once I run that feature file and import the cucumber.json or JUnit_Report.xml (from the Jira "Import Execution Results" button or from the API), Jira creates a new test issue inside the correct execution and associates the test run with that.

If I were trying to create a generic test, I think I would be able to simply edit the Generic Test Definition, but I need this to be a cucumber test. In this case, what is the best way to point my POST to the correct test (DSJ3-67)?

From digging, it looks like I will be using the cucumber-multipart endpoint, but I cannot find how to specify which test should be associated with the update in the info json file.

Thank you, please let me know if there is more information I can provide.

3 answers

1 accepted

1 vote
Answer accepted

Hi @rgnair 

 

The solution I have found to work has been adding the test execution's key (prefixed by an @ sign) to the top of my feature file prior to running the test. This adds a tag to your test result that will allow you to use curl to update the test execution.

My feature files all start like this:

@@test-exec-key-numbe
Feature:
Scenario Outline:
        Given ...
When ...
Then...

Then after I run my test, I curl:

curl -H "Content-Type: application/json" -k -X POST -u username:password --data @"filepath\to\cucumber.json" https://jira.ad.url.com/rest/raven/1.0/import/execution/cucumber

Hope this helps,

Connor

Thanks you so much @Connor Brown  its worked for me, thanks for the quick response.Here i am using bearer token as my authentication.Its working through Curl and POSTMAN, but when i used to post the xray result  through java using http client i am getting 401

post.setHeader(HttpHeaders.CONTENT_TYPE,"application/json");post.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + finalToken);

This is the way i am passing my token,i am wondering why 401 in both curl and POSTMAN its working with the above token
@Connor Brown anything i missed here in HTTP headers or any wrong
@Partha Mani 

 

 

 

@Connor Brown thanks, this makes sense. However, JIRA now using Auth tokens. I tried using mine and I cannot wok out the command.. It says

{"error": "Failed to parse Connect Session Auth Token"}

I used:

curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer MYTOKEN"  --data @"data.json" https://xray.cloud.xpand-it.com/api/v1/import/execution/cucumber

Maksym Sierov
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!
May 14, 2023

Solution still works, thanks

FYI  here is what you need to add

# "uri": "file:src/test/resources/features/r123.feature",
# "tags": [
# {
# "name": "@PR-1233",
# "type": "Tag",
# "location": {
# "line": 1,
# "column": 1
# },
# {
# "name": "@PR-1234", <--- id of the test execution
# "type": "Tag",
# "location": {
# "line": 2,
# "column": 1
# }
# },

@José Domingues [Xray] please provide a solution soon

José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Jan 27, 2020

Hi @rgnair 

To better address your issue, our support team will need more details to analyze the error. can you please open a ticket in our Service Desk

Thank you 

Team Xray 

0 votes
José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Dec 05, 2019

Hi Connor, 

Can you please open a ticket in our Support?

We need more information to better understand the issue.


Best regards,
Team Xray

Hi José Domingues

I also had the same issue when using the command ,its creating new instance instead of updating the existing key and test.

 

curl -H "Content-Type: application/json" -X POST -u username:password https://"domain"/jira/rest/raven/1.0/import/execution/cucumber?testExeKey=""

hi @Connor Brown is it possible to attach screenshots as execution proof ,either as a single PDF at the end or each step wise screenshot

@Connor Brown also i had tried the comments in one of your support ticket ,tried with byte64 encoding still not get the result

Hi rhnair,

                 I am working on Jenkins Job automation in my scenario I want to send executed cucumber JSON file to TM4J for updating the execution results.But  I dont have sample JSON file. Can you please share your sample JSON cucumber file. Because also working on same thing.

Suggest an answer

Log in or Sign up to answer