Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

xray test case import using REST api v2

Mounir Youssef
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!
January 26, 2021

Hi, i m trying to import my cucumber featre files to xray using the xray REST API v2. the story is already created and the test set is created as well . i expect to update or create tests for my requirement and assign the test to the right test set

1) api used:

curl -H "Content-Type: multipart/form-data" -X POST -H "Authorization: Bearer $token" -F 'file=@1_TR-2916.feature' https://xray.cloud.xpand-it.com/api/v2/import/feature?projectKey=TR

message received :

{"errors":[],"updatedOrCreatedTests":[{"id":"131590","key":"TR-5187","self":"https://mycompy.atlassian.net/rest/api/2/issue/131590"}],"updatedOrCreatedPreconditions":[]}


2) feature file content to be imported :

@REQ Tech Team_TR-2916
Feature: Admin can configure timecard management settings at company level
@test_TR-5187 @TESTSET_TR-471
Scenario: one-Admin updates sort Time Cards to Ascending Employee Last Name
When Login as default user admin_homer
When Update sort by to EMPLOYEE_LAST_NAME and sort order to ASCENDING in timecard settings
Then User should see updated sort by as EMPLOYEE_LAST_NAME and sort order as ASCENDING in timecard settings

@TESTSET_TR-4719
Scenario: two-Admin updates sort Time Cards to Descending Employee Last Name
When Login as default user admin_homer
When Update sort by to EMPLOYEE_LAST_NAME and sort order to DESCENDING in timecard settings
Then User should see updated sort by as EMPLOYEE_LAST_NAME and sort order as DESCENDING in timecard settings

expected results:

1) TR-5187 updated and linked to testset TR-4719 and tests TR-2916

2) new test created and linked to testset TR-4719 and tests TR-2916

 

Actual results:

1) TR-5187 got updated but not linked to testset TR-4719  however a label of TESTSET_TR-4719  is assigned instead

2) the new test is not created at all 

 

any advice ?

thank you

1 answer

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.
February 12, 2021

Hi @Mounir Youssef 

The behavior you have described is the current behavior of the feature in Xray, and you may confirm this in the product's documentation here: 

"Each .feature file will be processed and will try to find or create a Test/Pre-Condition inside the project given in the projectKey parameter."

So it only works for Test cases and Pre-Conditions.

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events