Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA XRAY plugin creates duplicate test case when importing using API and feature file

Edited

I have a bash script that takes all the feature files from a specific directory and uses `/rest/raven/1.0/import/feature?projectKey=XYZ` XRAY-JIRA API to create TEST CASES in JIRA.

`XRAY version 4.2.1_j7`

I am running this script in a JENKINS-PIPELINE but the problem is when I run it for the first time it creates test cases that are correct but when I re-run the build it starts creating the same test cases again (duplicating them), any suggestion/reason why this is happening

My bash script:
```
#!/bin/bash
find <DIR_PATH> -type f -name "*.feature" | while read fname;
do
curl -H "Content-Type:multipart/form-data" -X $USERNAME:$PASSWORD -F "file=@$fname"
https://<JIRA_URL>/rest/raven/1.0/import/feature?projectKey=XYZ
done
```

 

Sample feature file:
```
Feature Facebook Login

@login
Scenario: Log in to FB app
Given: User is at FB login page
When User enters username and password
Then User is logged in successfully
```

Please suggest to me how and where can I debug to fix the issue
Thanks

2 answers

Hi @Prashant Jeet Singh 

Please check the conditions that Xray uses to find if the Test case already exists, or if it is a new one and create it: https://docs.getxray.app/display/XRAY/Importing+Cucumber+Tests+-+REST

If you need further help, please get in touch with Xray Support (http://Xraysupport.getXray.app).

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

408 views 19 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