Import test cases from CSV files
Test cases can be imported from a third-party TMS or from a MS Excel document or from Google sheets document. Allure TestOps allows you importing the test cases using a CSV file.
The process of importing test cases
Preparing a CSV file
On the side of the third-party TMS (in MS Excel or in Google sheets), create a CSV file with the required data and follow the instructions and recommendations described in this article.
Import a CSV file
Open the test cases section.
At the top of the section, click the Import test cases button.
A CSV file can be either selected from OS file explorer or you can drag and drop your file to the drag and drop area of the UI.
Once the CSV file has been uploaded (1,2), click on the "Submit" button (3).
Parse uploaded CSV file for further mapping of the attributes.
the modal screen will have the following controls:
- headers in first row, this defines whether the very first row of your CSV file has the headers (they usually have, otherwise mapping will be a very tedious task).
- Auto detect format, will automatically detect the delimiter (separator) and escape chars.
As soon as the initial parsing has been completed, you will see the mapping controls on the test cases import form.
- Parsing settings described on previous steps. They can be reused to parse the file again in case you want or need to change the parsing settings.
- Id (numeric) of the column from CSV file, e.g.
Column 1
- The label of the column, which will be taken from the 1st line of CSV file if Headers in first row is checked. In the picture below, the label is
name
, which telling us the Column 1 contains the names of test cases. - An example of the content of the current column, as in the current example, the name of a test case being imported is
test case with many attributes
Configure the mapping between the fields in the CSV file and the attributes of the test cases in TestOps .
Fields mappings
There are three types of fields mappings – 1) simple field and 2) key + value mapping, and 3) complex (sounds scary, but it is not) fields mapping.
- simple field is directly linked to a test case attribute, for example name of a test case.
- key + value mapping is used to provide values to Custom fields and roles, e.g. key will be Feature, and value from CSV file will be "Authentication", or Role will be "Owner" and value from CSV file will be the name of a person, created this test case.
- Complex attributes will be test cases scenarios or lists like lists of tags. These fields could contain new lines, additional separators.
Mapping simple fields
As said above, simple fields are linked one to one from a column in CSV to a test case attribute.
Most common example of a simple field is test case name.
Name is mandatory parameter for a test case being imported from CSV file. If Name mapping is is missing, or even 1 test case's name is missing, the import process will be interrupted.
To map a simple field, under the CSV file column description select Allure TestOps test case attribute which must receive the information from the respective column.
If possible, Allure TestOps will suggest test cases attribute to map to, otherwise you need to select the attribute manually from the drop-down list.
Skipping fields
If a CSV file column contains the information which must not be imported, e.g. some information specific to the donor system, or if the column does not contain the information, it's recommended to choose Skip for such a field.
allure_id mapping
By all means, please, avoid mapping any data to Test case AllureId, this mapping has only one use – you perform export from a project, then you update the CSV file, then you import the data to the same project.
Allure TestOps does not allow random or user defined data to be used as AllureId, AllureId is a test case attribute fully managed by Allure TestOps.
Other examples of simple mappings
Other examples of simple mapping are
- description
- precondition
- expected result
Key + value mapping
This type of mapping is related to the following attributes
- Custom fields
- custom fields, often referred as meta data provide additional information on test cases used for grouping, searching
- Issues
- information used to link test cases to issue trackers' tasks
- Roles
- information used to link test cases to persons responsible for the maintenance of test cases or otherwise related to the said test cases
Mapping example
To map a particular column from CSV file as a custom field (issues and roles are mapped the same way), you need.
- Mark the column as a Custom Field
- Select the name of the Custom field (key) to map the column to.
- Provide the delimiter for the values.
Same way Roles are mapped to test cases.
Mapping complex fields
And example of a complex field could be a scenario of test cases.
Such fields could have several lines, tabulation characters.
By default, when no additional data provided to Split by field, for the scenario field Allure TestOps automatically performs the following parsing:
- new line character in the scenario will result in a new step of the target scenario.
- new line character followed by a tab character will result in the creation of a sub-step for previous step.
If your scenario has different structure, line numbers, then you would probably need using the regexp to clean the scenario from the additional redundant information and is't impossible to guarantee the target scenario will look the same way as it was in the donor system.
Final preview
As soon as you completed the mapping, you can check the import preview by clicking Show preview / Refresh preview button. Allure TestOps will create the preview of the test case as it will look when you complete the import procedure.
Complete the import
If you are happy with the preview results, you can complete the import by clicking Submit import button.
All test cases from the CSV file will be saved as Allure TestOps test cases based on the rules you created for the mapping of the CSV file columns to Allure TestOps test cases attributes.
The most common issues you can face during the import attempt are described in the troubleshooting section.
Troubleshooting
Request failed with the status code 400 - test cases with the following ids are not found
If the error 400 (test cases with the following ids are not found) occurs during import, it means that one or many invalid Allure ID(s) has been provided in the import data. Generally, you should not import any AllureId. To avoid this error, select Skip option for the Allure ID field. This will allow you to complete the import process successfully.