|
|
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:
|
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.
In this first example we exemplify how to import two test cases:
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
The CSV file used is the one below:
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;; 1;;;;;Enter username;peter; 1;;;;;Enter password;pwrd123; 1;;;;;Click login button;;User successfully logged in 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;; 2;;;;;Enter username;peter; 2;;;;;Enter password;abc123; 2;;;;;Click login button;;User logged in fails with message |
Notice that Component and Priority fields must match what you have defined in your project otherwise the import will fail. |
Once imported we will have two new test cases available:
In this example we are importing two manual tests cases with a description.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
A Description field was added to add the information, this field accept Wiki Markup.
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Description 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;;;"My description \\ multiline and *strong*" 1;;;;;Enter username;peter;; 1;;;;;Enter password;pwrd123;; 1;;;;;Click login button;;User successfully logged in; 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;;;"[Xray|http://www.getxray.app]" 2;;;;;Enter username;peter;; 2;;;;;Enter password;abc123;; 2;;;;;Click login button;;User logged in fails with message; |
As we can from the CSV above we have added two different descriptions that after the import will appear in Jira:
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.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
We will see that after importing these test cases they will have associated the labels added in this CSV.
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Label;Label 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;;;Label1; 1;;;;;Enter username;peter;;; 1;;;;;Enter password;pwrd123;;; 1;;;;;Click login button;;User successfully logged in;; 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;;;Label2;Label3 2;;;;;Enter username;peter;;; 2;;;;;Enter password;abc123;;; 2;;;;;Click login button;;User logged in fails with message;; |
When importing these test cases we have:
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.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Test Repo Path 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;;;Authentication/Login 1;;;;;Enter username;peter;; 1;;;;;Enter password;pwrd123;; 1;;;;;Click login button;;User successfully logged in; 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;;;Authentication/Login 2;;;;;Enter username;peter;; 2;;;;;Enter password;abc123;; 2;;;;;Click login button;;User logged in fails with message; |
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:
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.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
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.
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Test Repo Path;Requirement 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;;;Authentication/Login;COM-126 1;;;;;Enter username;peter;;; 1;;;;;Enter password;pwrd123;;; 1;;;;;Click login button;;User successfully logged in;; 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;;;Authentication/Login;COM-126 2;;;;;Enter username;peter;;; 2;;;;;Enter password;abc123;;; 2;;;;;Click login button;;User logged in fails with message;; |
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. |
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).
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
We are also adding a Browser field that will have the value to be set for that custom field.
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Browser 1;Test 1 for user story WEB-1;High;Interface;Account;Go to login page;;;Firefox 1;;;;;Enter username;peter;; 1;;;;;Enter password;pwrd123;; 1;;;;;Click login button;;User successfully logged in; 2;Test 2 for user story WEB-1;Highest;Interface;Account;Go to login page;;;Chrome 2;;;;;Enter username;peter;; 2;;;;;Enter password;abc123;; 2;;;;;Click login button;;User logged in fails with message; |
After importing the CSV file we will have:
In this example we will import two manual Tests with Attachments (either in the test step or in the test case).
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
For that we have added three new fields:
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:
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result;Attach Steps;Attach 1;Test 1 for user story WEB-1;High;User Interface;Business Layer;Go to login page;;;;https://docs.getxray.app/download/attachments/37062075/image2022-2-15_18-9-33.png 1;;;;;Enter username;peter;;; 1;;;;;Enter password;pwrd123;;; 1;;;;;Click login button;;User successfully logged in;; 2;Test 2 for user story WEB-1;Highest;User Interface;Business Layer;Go to login page;;;; 2;;;;;Enter username;peter;;;https://docs.getxray.app/download/attachments/37062075/image2022-2-15_18-9-33.png; 2;;;;;Enter password;abc123;;;https://docs.getxray.app/download/attachments/37062075/image2022-2-15_18-9-33.png; 2;;;;;Click login button;;User logged in fails with message;;https://docs.getxray.app/download/attachments/37062075/image2022-2-15_18-9-33.png; |
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.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
We will use the below CSV file to demonstrate this functionality.
TCID;Test Summary;Test Priority;Component;Component;Action;Data;Result 1;Test 1 for user story WEB-1;high;User Interface;Business Layer;Go to login page;; 1;;;;;Enter username;peter; 1;;;;;Enter password;pwrd123; 1;;;;;Click login button;;User successfully logged in 2;Test 2 for user story WEB-1;low;User Interface;Business Layer;Go to login page;; 2;;;;;Enter username;peter; 2;;;;;Enter password;abc123; 2;;;;;Click login button;;User logged in fails with message |
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:
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.
The next examples are using Components existent in our project, to import successfully make sure that Any Key/id used must exist in your project also. Make sure your are using the Test Priority values that are defined in your project. |
To exemplify I have created the following CSV file
TCID;Key;Test Summary;Test Priority;Component;Component;Action;Data;Result;Test Repo Path;Requirement 1;COM-147;Test 1 for user story WEB-1 Updated;High;User Interface;Business Layer;Go to login page;;;Authentication/Login;COM-126 1;;;;;;Enter username;peter;;; 1;;;;;;Enter password;pwrd123;;; 1;;;;;;Click login button;;User successfully logged in;; 2;COM-148;Test 2 for user story WEB-1 Updated;Highest;User Interface;Business Layer;Go to login page;;;Authentication/Login;COM-126 2;;;;;;Enter username;peter;;; 2;;;;;;Enter password;abc123;;; 2;;;;;;Click login button;;User logged in fails with message;; |
With this import we will update those two test cases (COM-147 and COM-148).
.toc-btf { position: fixed; } |