Xray: How to import feature file into test repository

Cedric Mathis February 14, 2020

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

0 votes
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2021

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]

0 votes
maarten.kuijpers June 10, 2021

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
José Domingues [Xray]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 24, 2020

Hi Cedric,

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

Best Regards,

Team Xray

chandan.varshney April 23, 2020

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.

Cedric Mathis April 23, 2020

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
chandan.varshney April 23, 2020

<?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

chandan.varshney April 23, 2020

Do we require token to authorize this request

Cedric Mathis April 23, 2020

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.

Julia Palacios Bernáldez January 4, 2021

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

Cedric Mathis January 5, 2021

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

Igor Gonzalez September 14, 2021

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

Like Braian Romero likes this
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2021

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