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

Xray: How to import feature file into test repository

Hello,

I am using Jira v8.5.1 and I am currently working on a project that involves XRAY APIs.

I need to import a Cucumber Test file, so I'm using the POST /rest/raven/1.0/import/feature API.

But now, the client is asking me to import it into a specific XRAY Test Repository.

I could not find so far any solution to this in the documentation. I found how to create a repository, but not how to upload a feature file directly into it.

Do you have any idea how I could achieve this ?

Thanks a lot for your help.

Cedric

3 answers

Hi @maarten_kuijpers 

This improvement suggestion is currently Under Consideration.

Although we don't yet have a release date to include it in the product, we considered this an important feature, and we're looking to release it when possible.

Thank you.

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

Hi X-Ray! We're 1,5 year later now since the previous response. Are there any plans to have the import take note of the position in the repository automatically? It would avoid us a lot of manual work to put the Tests on the right place. I imagine that in case you import a ZIP file with feature files in folders, it would automatically try to map the folder names to Repository paths. Current behaviour is that the folder in which the feature resides is becoming a JIRA Label. Another solution would be have a Label-to-Repository-path option in X-Ray itself?

0 votes

Hi Cedric,

Currently, this is not possible. However, we have this suggestion already in our backlog:  XRAY-4408

Best Regards,

Team Xray

Hi Cedric Mathis,

Can you please let me know how you are using POST /rest/raven/1.0/import/feature API. I am facing issues with this API. Please send me header section and complete URL for this request.

Hi,

I am using a simple curl for this API :

curl -H "Content-Type:multipart/form-data" -u $CREDENTIALS -F "file=@$FILE_LOCATION" https://$JIRA_URL/rest/raven/1.0/import/feature?projectKey=$PROJECT_KEY

With parameters :

  • $CREDENTIALS  to connect to the application
  • $FILE_LOCATION   which is the feature file I'm uploading
  • $JIRA_URL which is the URL of our Jira server
  • $PROJECT_KEY which is the key of the Jira project in which I'm uploading

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>404</status-code>
<message>null for uri: https://JIRAURL/rest/raven/1.0/import/feature?projectKey=$projectKey</message>
</status>

 

I am getting this response when I am hitting this request using POSTMAN. Credentials I have passed as Basic Auth in header of request

Do we require token to authorize this request

I needed an account to Jira, but that's it. There are no specific rights  (basic rights, jira-users).

 

The "null for uri"  is like the page you're trying to reach does not exist.

I have the same problem! 

http://mysite.atlassian.net/rest/raven/1.0/import/feature?projectKey=myproject, I have this uri and I'm authenticating with token in basic auth.

Postman returns null for uri 404, and I don't know what is missing...

Hello Julia,

Personnaly, I did it with curl, like this, and this is working just fine: 

curl -H 'Content-Type:multipart/form-data' -u $USERNAME:'$PASSWORD' -F 'file=@${IMPORT_FILE}' https://${JIRA_URL}/rest/raven/1.0/import/feature?projectKey=${PROJECT_KEY}

 

Just be sure that the user is defined in Jira, and that should do it

Hello Cedric,

I have same issue. The only diferent thing is that i use a Token for authenticated and when I send the request, the response is 404.

The Token was correctly generated and i checked it.

Maybe I don't use correctly the API for Jira Cloud and Xray?

Is correct for Jira Cloud and Xray, use this url, "https://myCompany.atlassian.net/rest/raven/1.0/import/feature?projectKey=${PROJECT_KEY}"

 

Regards.

 

Edit: It solved

Hi @Igor Gonzalez 

Glad to see that it is solved.

Nevertheless, let me leave a general explanation of how the API works in Xray Cloud:

  1. It is necessary to use token (not username/password like in DC-server),
  2. On Cloud, Xray runs on a different server, so the request must be sent to the Xray server (xray.cloud.xpand-it.com) and not to the Atlassian server. So the correct URL is like this: https://xray.cloud.xpand-it.com/api/v1/import/feature?projectId=${PROJECT_KEY}
  3. Please check the correct documentation for the hosting. Since Xray DC-Server and Xray Cloud are in fact two different Apps and although we try to keep them as similar as possible, there are differences. So some features in DC-Server could be different in Cloud. This is the Xray Cloud  Documentation: https://docs.getxray.app/display/XRAYCLOUD/About+Xray

Thank you.

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

Suggest an answer

Log in or Sign up to answer
TAGS

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