What you'll learn
- Different usages of Test Case Importer
- Import different test cases (with different fields and options)
- Validate in Jira that the test cases are available
Source-code for this tutorial
- All examples are available in GitHub
Test Case Importer is used to import test cases in a CSV format into Xray, this functionality is used to migrate from other tools or to import manual test cases written in other formats into Xray.
In this tutorial we will provide different examples of how to import test case in the CSV format into Xray.
Notice that until version 6.2 Test Case Importer only allow to import/update manual tests cases.
If you need to import other types of tests you should use the Jira CSV importer instead.
For these examples we will use the Test Case Importer tool, which is present when you install Xray in your Jira instance.
We will need:
- Access to a Jira instance with Xray installed
In each example we will have available the CSV file corresponding to the test cases definition and the configuration file used in the Test Case Importer to perform the operation.
We will showcase different possibilities when importing test cases into Xray, using combination of fields and possibilities that should cover most usages.
If you have doubts on where to find the tool or use it please check more information in the Test Case Importer page.
All of the examples in this tutorial have a CSV file with the definition of the test cases to import and a configuration file that will configure all associations and fields for the importation to be successful.
Import manual test cases
In this first example we exemplify how to import two test cases:
- Each test case with a proper summary, priority, component association and where we define the manual steps with action, data and result.
The CSV file used is the one below:
Once imported we will have two new test cases available:
- one for successful login
- one for unsuccessful login
Import manual test cases with description
In this example we are importing two manual tests cases with a description.
A Description field was added to add the information, this field accept Wiki Markup.
As we can from the CSV above we have added two different descriptions that after the import will appear in Jira:
- The description added to the first test where we can see that is a multiline text with the word strong in bold.
- The description of the second test where. we are adding a link to an application.
Import manual test cases with labels
One common case is also the usage of labels, in the following example we are inserting new fields (as much as the number of labels we want to add) called Label.
We will see that after importing these test cases they will have associated the labels added in this CSV.
When importing these test cases we have:
- one test case with Label1
- a second test case with two labels: Label2 and Label3
Import manual test cases with Test Repository
In this example we are using the same base as the previous importation but adding a new field called: Test Repo Path, that will allow us to organize these tests into a specific folder in the Test Repository.
On the setup stage make sure you check the option Create Folders (as shown in the below screenshot) to create the Test Repository folders in case they do not exist.
Once imported the tests will be created, all within the folder Authentication/Login of the Test Repository:
Import manual test cases with Test Repository and link to requirement
When importing manual test cases you can organize them in specific folder within the Test Repository but also link those to the requirements they are covering.
In the CSV file we are using a new filed called requirement to specify the Issue Key of the requirement we want to link with the test case. In our case we are linking those to the User Story COM-126.
Notice that you must use valid requirement Keys (that exists in your Jira installation) otherwise the import will fail.
Once the import operation is successful we will have two new manual test cases covering the requirement COM-126.
In order to have this example working for you you must replace the requirement Key (COM-126) by requirement Keys that exists in your Jira instance.
Import manual test cases with custom Test Step and Components
In the next example we are importing two manual test cases and add information into a test step custom field we have added previously and of Components.
The custom Test Step field added is called MyBrowser:
As we can see in the contents of the below file, we are using multiple Component entries because we want to associate multiple Components to the test case (this will multiply for the amount of Components we want to associate).
We are also adding a Browser field that will have the value to be set for that custom field.
After importing the CSV file we will have:
- Two new Tests
Import manual test cases with attachments
In this example we will import two manual Tests with Attachments (either in the test step or in the test case).
For that we have added three new fields:
- Attach Steps - That will have the attachments to be added in the Test Steps;
- Attach - To add attachments in the test case.
The attachment may be referred by name (in this case the file:// protocol is assumed), by "file://" or "http(s)://". Multiple files may be specified within one CSV column; for this, the attachments must be delimited by space.
For file protocol, only files in the "<JIRA_DATA_HOME>/import/attachments" folder will be imported.
Looking at the CSV file we can see those new fields:
This will create two Tests, one Test Case with an attachment in the test step and another with an attachment in the Test as we can see:
Please check this page for more details on the attachment features.
In some cases we can use priorities in our CSV file that do not match the ones we have defined in the Jira project (using different definitions or just different lower/upper case in the word).
Instead of changing all priority fields in all CSV files we can define a mapping that will associate the priorities in our CSV file to the ones in the Jira project.
We will use the below CSV file to demonstrate this functionality.
To accomplish that we will check the checkbox Map Field Value next to the Test Priority field:
Next we will define the mapping between our priorities and the ones present in the Jira project:
Finally we will see that the imported Tests will have the correct association of priorities:
Update two manual test cases
If your intent is not to create new test cases but to update test cases you must refer to the test case Issue Key that you want to update.
In the setup steps we will need to map the fields to be used, make sure you are mapping the Key to the Issue Key so that the update to happen.
When importing the Test Case Importer will update the test case instead of creating a new.
To exemplify I have created the following CSV file
With this import we will update those two test cases (COM-147 and COM-148).
- Use the CSV file provided to import the examples and the txt configuration associated to it in order to have the correct setup and mapping.
- Remind to replace the Project Keys, test case Keys, Custom Fields and requirements for some existing in your Jira instance.