You can use the Xray's Test Case Importer to import new or existent tests, preconditions and test sets issues from a CSV or JSON source file.
The Test Case Importer follows a wizard like interface, guiding you through the process which envolves:
The Test Case Importer is only able to create or update tests, preconditions and test set issues. If you wish to create or update other types of issues, you should use Jira's CSV importer instead. Note that Jira's CSV importer is not able to handle any Xray related semantics though. |
Please see a tutorial with working Examples using Test Case Importer, showcasing different scenarios, which you can download and try by yourself. |
Xray provides the ability to import multiple Tests, Preconditions or Test Sets at once either as a standard user or as a Jira administrator; the user can create or update all those issues types with a maximum number limit of 1000 issues per import.
Only users that have the Make Bulk Changes permission will have this option available. The configuration can be found in the Jira Administration / System. Additionally, the user will only be able to import data into projects where he has the Create Issues permission. This configuration can be found in the Jira Projects / Project Settings / Permissions. |
Go to Apps > Xray. In the "Xray" side menu, select "Test Case Importer" and then select the format you want to use (e.g. CSV).
The Test Case Importer is also accessible from within the Testing Board of a Xray-enabled project.
|
Please check multiple examples in the tutorial Examples using Test Case Importer (as well as code in GitHub).
The CSV source file must follow some simple rules.
You can name the fields as you wish since they are going to be mapped during the importation process, but there are three mandatory fields that must be mapped:
Here is an example of a source file as seen in a spreadsheet application:
Here is the same example as seen in a text editor:
The issues can all be imported to the same project or into multiple projects, one column in the source file can be used to define the destination project (either by having its key or id). |
If you choose the "," (comma) as the CSV column delimiter, then you must use quotation marks around any field that contains commas. The same is true if you use ";" (semicolon) as a delimiter and you want to use them in a field, for example as a list value delimiter (see the example above). |
If you need to use new lines within a field, for example, in the issue description, then you need to quote the field. |
The <<!clear!>> special marker removes the values of the field (with the exception of test step fields) where is it specified (only applicable as a valid input of a csv file). |
Open Test Case Importer and select CSV format.
Provide the source file and settings regarding the file to import.
Additional setup information, for choosing the destination project along some settings related with the source data.
During this step, you'll define the mapping of columns to Jira/Xray fields.
There are three mandatory fields that must be mapped: Test ID, Summary and Test Type.
Besides these ones, if you have defined additional fields as mandatory for Test issues, then you will also need to specify their mapping.
The project to which the test will be imported can be defined for each issue in a field. The fields "Project Key" or "Project Id" can be used for this.
If no project field is mapped or when the value in this field is empty, the project selected in the Setup step will be the one where these issues will be imported into.
To update existing issues, your CSV file needs to contain a column that maps to Issue Key. If an issue exists for a given key, it will be updated.
The type of the issue being imported. The supported issue types are:
If no issue type is defined for an issue being imported, it will default to test. When updating issues, the field can be left empty on the csv file.
The type of the Test being imported. Must be filled for a Test in your CSV file, when creating one, and can be left empty when updating an existing Test.
The type of the Precondition being imported. Must be filled for a Precondition in your CSV file, when creating one, and can be left empty when updating an existing Precondition.
The "Steps", "Definition" or "Background" of a manual, generic or cucumber Precondition type, respectively.
Only for test issues, a list of preconditions to which a test will be added.
Each value should be the issue key of an existing precondition or the id of a precondition also being imported ("Test ID" field).
Only for test issues, a list of test sets to which a test will be added.
Each value should be the issue key of an existing test set or the id of a test set also being imported ("Test ID" field).
The Test Repository folder path to the folder in which the Tests will be associated.
The folder path consists of folder names separated by the "/" character, for example: Main Tests/Sub Tests 1/Inner Tests 2
List fields can hold multiple values separated by the list delimiter defined in the Setup step.
Links can be created between imported tests and other existent issues using the "Link ..." Jira fields. Only applicable when creating an test.
The field is a list field and the value of the respective field should hold a list the issue keys of the issues to link to the test.
The direction (inward/outward) can also be specified.
Due to technical restrictions there is a limit to the total amount of links the import file can have. The limit is 2000 issue links apart from the first one in every test. |
Datetime fields must have values that can be parsed using the Datetime format in the Setup step.
This page explains possible date formats and respective values.
You can also map columns to test step fields for manual tests.
The fields are in the group "Xray Test Step Fields".
The configured test step fields for every project in the instance is shown here and the ones that are required are shown with a "*".
The "Definiton" of a generic Test type.
The "Scenario/Scenario Outline" of a cucumber Test type.
After this step the import process will start.
The JSON source file must have the same structure as the one used in the import through the REST API.
Example of one test being create and one existent test being updated in the JSON import format:
Example of one Test Set being created and one existent Test Set being updated in the JSON import format:
Example of one Precondition being created and one existent Precondition being updated in the JSON import format:
Open Test Case Importer and choose the JSON file format.
Choose the file having the source data to import from.
Choosing the default project to import into. If each test to import already refers to a project, this field is not necessary to be filled, otherwise you should choose a project.
After the import process has began its status will be periodically updated in the Test Case Importer page. No new import process can be started until the current one finishes.
After the process finishes the result will be visible for about a day and then it will be removed from the page.
Example of 5 tests imported successfully:
You may also download the detailed import results, this is useful to get the issue keys of the imported issues and also to see which issues were not imported and why.
Example of 2 issues imported out of 5:
Example of detailed import results:
In the detailed import results, the elementNumber
field represents to which issue the information corresponds to (elementNumber 0 being the first issue).
When importing tests into Test Repository folders, if for any reason the process is unable to create a folder or move a test to the respective folder, the respective tests will be still be migrated and a warning detailing the situation will be written to the import result.
When importing a file, when the import status is being shown, you can download the configuration file that will have all the settings you've set:
And then you can use it when you import the next file (if the configurations are supposed to be the same or similar):
Please see a tutorial with working Examples using Test Case Importer, showcasing different scenarios, which you can download and try by yourself.