Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. try to find the Test by key, if found then update it; else...
  2. try to find the Test having:
    1. a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
    2. a label named "id:xxx", where xxx is some number (e.g. "id:1", "id:32"); this label comes from a scenario/scenario outline's tag
    3. no other label ending in ".feature"
  3. try to find the Test having:
    1. a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
    2. the same summary
    3. no other label ending in ".feature"
  4. try to find the Test having:
    1. the same Summary
    2. no label ending in ".feature", except the one corresponding to the relative path of the Cucumber file being imported
  5. When a Test is found, if Xray Enterprise is enabled, the import will update
    • the default version if it is Cucumber/Gherkin,
    • the latest active Cucumber/Gherkin test case version.
    • create a new version if none of the previous ones are matched
  6. create Test in that project and add a label with the relative path of the feature. The tags used in the scenario/scenario outline are also added as labels.

...

  1. try to find the Pre-Condition by key, if found then update it; else...
  2. try to find the Pre-Condition having both:
    1. a label with the original relative path of .feature (e.g. "core/sample_addition.feature)
    2. no other label ending in ".feature"
  3. try to find the Pre-Condition having both:
    1. the same Summary
    2. no label ending in ".feature", except the one corresponding to the relative path of the Cucumber file being imported
  4. create Pre-Condition in that project and add a label with the relative path of the feature


Organization:

  1. updateRepository Query Parameter:
    A new query parameter named updateRepository is added to the REST API endpoint for importing cucumber features.

  2. Default Behavior:

    1. When the updateRepository parameter is not provided, it defaults to updateRepository=false.

    2. In this default state, the Test Repository will not be updated to maintain compatibility with previous versions.

  3. Enabling Repository Update:

    1. If updateRepository=true is specified, the imported Tests will be organised into the Test Repository.

    2. The organisation of Tests follows the folder structure defined in the import zip file.

  4. Automatic Folder Creation:

    1. Folders will be automatically created in the Test Repository if they do not exist as per the structure in the import file.

  5. Handling Test Movement:

    1. If an existing feature is updated and its location is changed to a different folder, Xray will move the Tests to the new folder accordingly.

  6. Error Handling for Folder Creation:

    1. If a folder cannot be created due to naming issues or other conflicts, an HTTP 400 error will be returned.

    2. The system will attempt to update the folder locations for other valid features in the import, allowing for partial updates where possible.

Considering the above zip folder structure:
Image Added
 System will import into the following Test Repository path:

    1. Folder "Math"
      Tests Cucumber test C and D
    2. Folder "Math/Sub"
      Test Cucumber test B
    3. Folder "Math/Sum"
      Test Cucumber test A


The mapping from the Scenario/Scenario Outline present in the .feature files to the Test issues in Jira would be as follows:

...


Expand
titlePOST /rest/raven/1.0/import/feature
Panel
borderColor#ccc
borderStylesolid

Request

QUERY PARAMETERS

parameter
type
description
projectKeyString

key of the project where the tests and pre-conditions are going to be created.

updateRepositoryBoolean

Option to organise imported Tests in the Test Repository folders. (true/false)

multipart/form-data:

"file" : a MultipartFormParam containing a ".feature" file or a ZIP file to import.

Tip
titleExample Request

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@1.feature" http://yourserver/rest/raven/1.0/import/feature?projectKey=DEV

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@features.zip" http://yourserver/rest/raven/1.0/import/feature?projectKey=DEV

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@features.zip" http://yourserver/rest/raven/1.0/import/feature?projectKey=DEV&updateRepository=true

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@features.zip" -F "testInfo=testInfo.json" -F "preCondInfo=precondInfo.json"  http://yourserver/rest/raven/1.0/import/feature?projectKey=DEV

Responses

200 OK : application/octet-stream : Successful. The cucumber features where successfully imported to Jira.

Code Block
titleExample Output
[
	{
		"id":"14400",
		"key":"DEV-915",
		"self":"http://localhost:8727/rest/api/2/issue/14400",
		"issueType": {
            "id": "10100",
            "name": "Test"
        }
	},
	{
		"id":"14401",
		"key":"DEV-916",
		"self":"http://localhost:8727/rest/api/2/issue/14401",
		"issueType": {
            "id": "10103",
            "name": "Pre-Condition"
        }
	}
]


400 BAD_REQUEST : text/plain: Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred when generating the feature file(s).