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 which 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 me how and where can I debug to fix the issue Thanks
First, I would highly recommend you to upgrade to the latest version is your current version is "rather old". Version 6.0 was just released few days ago. I don't any open bug related to that, except this bug that been solved many releases ago. You can try importing using a zip file, in a single request (which is more efficient btw). Maybe this approach implicitly addresses your problem, in the version in that you have.
Example:
rm -f features.zip
zip -r features.zip src/test/resources/calculator/ -i \*.feature
curl -H "Content-Type: multipart/form-data" -u admin:admin -F "[email protected]" "http://192.168.56.102/rest/raven/1.0/import/feature?projectKey=CALC"
If the problem persists, then mostly there's a bug there; please reach out Xray support team, so the team can properly analyze it with you.