What you'll learn

  • How to export test cases from PractiTest
  • Use a script to convert the exported CSV test cases to an Xray compatible CSV file
  • Import different test cases (with different fields and options)
  • Validate that the test cases were imported to Xray

Source-code for this tutorial

  • All examples are available on GitHub

Overview

This tutorial explains how to export test cases from PractiTest and import them into Xray.

PractiTest is a test management tool that runs independently in the cloud. In this tutorial, you will learn how to export the test cases from PractiTest in an CSV format, how to use a script (available in GitHub) to convert the PractiTest CSV file into a Xray compatible CSV so that it can be imported into Xray using the Test Case Importer.

This tutorial will provide different examples of exporting and importing test cases from PractiTest into Xray. 

Features and Limitations

Below is a list of the support features and current limitations.

Migration from PractiTest is limited to the information we can export from PractiTest and how it can be mapped to Xray entities.

Most of the test case information will be migrated seamlessly, but please check the following table for more details.

Supported FeaturesUnsupported
  • Test and Test steps
  • Preconditions
  • Test Steps (modular)
  • Test case attachments
  • Test Runs
  • Test Sets
  • Defects and Requirements


How it works

In PractiTest, users can specify and organize tests into test sets. Each test set can have multiple tests.

On the creation screen, users can create tests of one of the following test types: Scripted, Exploratory, BDD, and Automated. The Scripted type allows you to describe the test case in different steps with action and expected result. Another option is to create a Exploratory test that has specific fields that let you define the test charter and some guide points. It's also possible to define Behaviour Driven Development (BDD) test scenarios using Gherkin. An Automated type is also available to abstract automated tests.

In PractiTest, to execute tests, you need to associate them to a test set.

PractiTest uses different entities to describe tests and the flow, so we have synthesized into the next table the existing mappings between PractiTest and Xray.

PractiTestXrayComments
TestTest

PractiTest does not support data sets, only manual/automated test steps.

In PractiTest, when you choose to export using CSV format, it will export all tests. All steps are exported except for the called tests, which have an empty description.

Precondition

(Field in Test entity)

Precondition

(independent entity)

In PractiTest, the precondition is one field in the test case.

In Xray, a Precondition is a different entity and one Test Case can be linked to several Preconditions.

The precondition field from PractiTest is converted into a Precondition issue in Xray and linked back to the Test.




Prerequisites


We will use the Test Case Importer tool for these examples, which is present when you install Xray in your Jira instance.

 We will need:

  • Access to PractiTest instance to export test cases in CSV format
  • Access and usage of scripts to convert PractiTest CSV test cases to CSV Xray import files
  • Access to a Jira instance with Xray installed
  • Only users that have the Make Bulk Changes permission will have this option available. Additionally, the user will only be able to import data into projects where he has the Create Issues permission.




Examples

In each example, we will show how we obtained the CSV file from PractiTest, made the files available in GitHub, how to use the scripts to convert the CSV files into compatible CSV files, and finally, how to import the CSV files into Xray.

We will showcase different possibilities when exporting test cases from PractiTest, using a combination of fields and possibilities that should cover most usages.

All of the examples in this tutorial have a CSV file exported from PractiTest, 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.


Export to CSV from PractiTest and Import into Xray

In PractiTest, when you choose to export, it will export everything; no option is given to choose to specify what you want to export. In this example, we are focusing on that option.

To export from PractiTest, we are using the Export All Tests option in the Project SettingsImport & Export upper menu entry.

Once clicked PractiTest will generate the file and make it available here. Click on the link "click here to Download" to download the CSV file.

Plan your test exportation because PractiTest limits the exportation to once every 2 hours and the new file will replace the old one. 

After 72 hours the files are automatically deleted.


Looking into more detail on what we have in PractiTest, we can see that we have 7 tests defined:

  • 4 Scripted Tests 
  • 1 API test
  • 1 Exploratory test


The file generated by PractiTest has the following content:

practiTest_export.csv
id,Name,Description,Status,Author,Run_status,Last Run,created at,updated at,Test_type,Tags,Preconditions,Value Score,Scenario,Automation candidate,Feature,Sub Feature,Test Level,Comments,Step name,Step description,Step expected_results,Step position,Traceability - Requirements,Traceability - Issues
1,Login Validations,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*

> My quote from the text",Draft,Cristiano Cunha,PASSED,10-Jan-2024  11:12,09-Jan-2024  09:37,10-Jan-2024  11:12,ScriptedTest,"","Applicaiton is accessible and the main page is loaded

**Bold**

*Italic*

Bulllets:
1. one
2. two
3. three",N/A,"",no,,,,"",Open application main page,Access main page of the application,The applciation main page appear with the option to login,1,1,""
"","","","","","","","","","","","","","","","","","","",Insert username in the login form,"Insert ""Manuel"" in the username field","""Manuel"" appears in the usernam field",2
"","","","","","","","","","","","","","","","","","","",Insert password in the password field,"Insert ""password"" in the password field",The password is hidden in the password field (we can only see a serie of *),3
"","","","","","","","","","","","","","","","","","","",Submit login,"Press the ""login"" button",The application changes to a page where the user is logged in.,4
2,Logout validation,Validate that a logged in user can logout.,Draft,Cristiano Cunha,PASSED,09-Jan-2024  16:07,09-Jan-2024  09:42,09-Jan-2024  09:42,ScriptedTest,"","",N/A,"",no,,,,"",,,,1,1,""
"","","","","","","","","","","","","","","","","","","",Press the logout button,"Press the ""logout"" button",User is redirected to the main page in **logged** out state,2
3,BDD Test,"Description of the BDD Test
**Bold**
*Italic*

Bullet list:
1. one
2. two three",Draft,Cristiano Cunha,NO RUN,,09-Jan-2024  11:27,11-Jan-2024  11:17,BDDTest,"","",N/A,"Scenario: BDD Test
Given I access the main page of the application
When I click the listing link
Then I'm taken to the listing page",no,,,,"",Given ,I access the main page of the application,"",1,2,""
"","","","","","","","","","","","","","","","","","","",When ,I click the listing link,"",2
"","","","","","","","","","","","","","","","","","","",Then ,I'm taken to the listing page,"",3
4,API Test,API tests - Automated,Draft,Cristiano Cunha,NO RUN,,09-Jan-2024  11:29,09-Jan-2024  11:29,ApiTest,"","",N/A,"",no,,,,"", , , , ,"",""
5,Explore the listing page,"",Draft,Cristiano Cunha,NO RUN,,09-Jan-2024  16:03,09-Jan-2024  16:03,ExploratoryTest,"","",N/A,"",no,,,,"", , , , ,2,""
6,Scripted test AI,Scripted test generated by AI (Smart Fox),Draft,Cristiano Cunha,NO RUN,,09-Jan-2024  16:21,09-Jan-2024  16:21,ScriptedTest,"","",N/A,"",no,,,,"",Initialization,Start the application to test the baseline state before performing any scripted actions.,The application launches successfully and presents the initial screen.,1,"",""
"","","","","","","","","","","","","","","","","","","",Navigate to Feature X,"Use the navigation menu to go to Feature X, which is to be tested.",The Feature X page is displayed correctly without any errors.,2
"","","","","","","","","","","","","","","","","","","",Input Test Data,Enter the required test data in the input fields for Feature X.,The data is accepted by the input fields without validation errors.,3
"","","","","","","","","","","","","","","","","","","",Execute Function,"Trigger the function linked with Feature X using the appropriate action (e.g., click the 'Run' button).","The function executes as expected, and the appropriate success message is displayed.",4
"","","","","","","","","","","","","","","","","","","",Verify Outcome,Check the output or changes caused by the execution of Function in Feature X.,The output or changes are as per the expected outcomes defined in the test case.,5
7,Detail page validations,As I User I want to be able to enter a detail page of a product to see more information on it and be able to act upon it,Draft,Cristiano Cunha,NO RUN,,10-Jan-2024  09:11,10-Jan-2024  09:11,ScriptedTest,"","",N/A,"",no,,,,"",,,,1,3,""
"","","","","","","","","","","","","","","","","","","",Go to listing page,"Press the Listing page link ont the page.

**Bold**

*Italic*

Bullets:
1. one
2. two 
3. three",The application reloads and and the user is taken to the listing page,2
"","","","","","","","","","","","","","","","","","","",Choose the first item,Press the first item in the list,The application loads the detail page of the item,3


To import into Xray, we created one script to convert this CSV file into a CSV-compatible file to be imported into Xray.

The script will parse the PractiTest CSV file and create a CSV file that can be imported into Xray. To execute the script, use the following command:

python3 practitest2Xray.py -i practitest_export.csv -o practitest_xray_results.csv


The output file has all the test steps and, if you have used a precondition in PractiTest, it will create a precondition in Xray and link it to the test.

practitest_xray_results.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Issue Type,Precondition,Precondition Type,Description,Unstructured Definition,Gherkin Definition
1,,,Applicaiton is accessible and the main page is loaded
,,,,,precondition,,Manual,"Applicaiton is accessible and the main page is loaded

**Bold**

*Italic*

Bulllets:
1. one
2. two
3. three",,
3,,Manual,Login Validations,3,Access main page of the application,,The applciation main page appear with the option to login,Test,1,,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*

> My quote from the text",,
3,,Manual,,3,"Insert ""Manuel"" in the username field",,"""Manuel"" appears in the usernam field",Test,,,,,
3,,Manual,,3,"Insert ""password"" in the password field",,The password is hidden in the password field (we can only see a serie of *),Test,,,,,
3,,Manual,,3,"Press the ""login"" button",,The application changes to a page where the user is logged in.,Test,,,,,
4,,Manual,Logout validation,3,Test step imported from another test.,,,Test,,,Validate that a logged in user can logout.,,
4,,Manual,,3,"Press the ""logout"" button",,User is redirected to the main page in **logged** out state,Test,,,,,
5,,Cucumber,BDD Test,3,,,,Test,,,"Description of the BDD Test
**Bold**
*Italic*

Bullet list:
1. one
2. two three",,"Scenario: BDD Test
Given I access the main page of the application
When I click the listing link
Then I'm taken to the listing page"
6,,Manual,Scripted test AI,3,Start the application to test the baseline state before performing any scripted actions.,,The application launches successfully and presents the initial screen.,Test,,,Scripted test generated by AI (Smart Fox),,
6,,Manual,,3,"Use the navigation menu to go to Feature X, which is to be tested.",,The Feature X page is displayed correctly without any errors.,Test,,,,,
6,,Manual,,3,Enter the required test data in the input fields for Feature X.,,The data is accepted by the input fields without validation errors.,Test,,,,,
6,,Manual,,3,"Trigger the function linked with Feature X using the appropriate action (e.g., click the 'Run' button).",,"The function executes as expected, and the appropriate success message is displayed.",Test,,,,,
6,,Manual,,3,Check the output or changes caused by the execution of Function in Feature X.,,The output or changes are as per the expected outcomes defined in the test case.,Test,,,,,
7,,Manual,Detail page validations,3,Test step imported from another test.,,,Test,,,As I User I want to be able to enter a detail page of a product to see more information on it and be able to act upon it,,
7,,Manual,,3,"Press the Listing page link ont the page.

**Bold**

*Italic*

Bullets:
1. one
2. two 
3. three",,The application reloads and and the user is taken to the listing page,Test,,,,,
7,,Manual,,3,Press the first item in the list,,The application loads the detail page of the item,Test,,,,,




To import it into Xray, we use Test Case Importer with the recently created CSV file; you can use the configuration file provided with the .json extension (importConfiguration.json).

Once imported we can see that it has created two Preconditions and five Tests with all the properties defined in the CSV.


More Details

Let's look into some specificities of this approach and some test particularities.

Precondition field into Precondition issue

In PractiTest Preconditions are another field in the Test.


The precondition is exported in a 'preconditions' field as we can see below. 

precondition in comic_estore.xml
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Issue Type, "Precondition", "Precondition Type", "Description", Unstructured Definition,Gherkin Definition
id,Name,Description,Status,Author,Run_status,Last Run,created at,updated at,Test_type,Tags,Preconditions,Value Score,Scenario,Automation candidate,Feature,Sub Feature,Test Level,Comments,Step name,Step description,Step expected_results,Step position,Traceability - Requirements,Traceability - Issues
1,Login Validations,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*

> My quote from the text",Draft,Cristiano Cunha,FAILED,09-Jan-2024  16:06,09-Jan-2024  09:37,10-Jan-2024  09:14,ScriptedTest,"","",N/A,"",no,,,,"",Open application main page,Access main page of the application,The applciation main page appear with the option to login,1,1,""
"","","","","","","","","","","","","","","","","","","",Insert username in the login form,"Insert ""Manuel"" in the username field","""Manuel"" appears in the usernam field",2
"","","","","","","","","","","","","","","","","","","",Insert password in the password field,"Insert ""password"" in the password field",The password is hidden in the password field (we can only see a serie of *),3
"","","","","","","","","","","","","","","","","","","",Submit login,"Press the ""login"" button",The application changes to a page where the user is logged in.,4

...


When converting into a CSV for Xray we are creating a new issue of type 'precondition' and linking it to the Test.

Precondition in comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Issue Type,Precondition,Precondition Type,Description,Unstructured Definition,Gherkin Definition
1,,,Applicaiton is accessible and the main page is loaded
,,,,,precondition,,Manual,"Applicaiton is accessible and the main page is loaded

**Bold**

*Italic*

Bulllets:
1. one
2. two
3. three",,
3,,Manual,Login Validations,3,Access main page of the application,,The applciation main page appear with the option to login,Test,1,,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*

> My quote from the text",,
...


Once imported into Xray, we can see that the first line creates a Precondition in Xray.

The next line creates a Test and links the Precondition created in the same operation.

Scripted Tests into Manual Test Case

PractiTest allows you to create Manual Test Cases with steps (using action and expected result).

We have created one test case using the steps separated into fields. The CSV output is the following:

Manual Tests in practitest_export.csv
id,Name,Description,Status,Author,Run_status,Last Run,created at,updated at,Test_type,Tags,Preconditions,Value Score,Scenario,Automation candidate,Feature,Sub Feature,Test Level,Comments,Step name,Step description,Step expected_results,Step position,Traceability - Requirements,Traceability - Issues
1,Login Validations,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*",Draft,Cristiano Cunha,PASSED,10-Jan-2024  11:12,09-Jan-2024  09:37,15-Jan-2024  12:00,ScriptedTest,"","Application is accessible and the main page is loaded

**Bold**

*Italic*

Bulllets:
1. one
2. two
3. three",N/A,"",no,,,,"",Open application main page,Access main page of the application,The applciation main page appear with the option to login,1,1,""
"","","","","","","","","","","","","","","","","","","",Insert username in the login form,"Insert ""Manuel"" in the username field","""Manuel"" appears in the usernam field",2
"","","","","","","","","","","","","","","","","","","",Insert password in the password field,"Insert ""password"" in the password field",The password is hidden in the password field (we can only see a serie of *),3
"","","","","","","","","","","","","","","","","","","",Submit login,"Press the ""login"" button",The application changes to a page where the user is logged in.,4
...


After running the script that converts the above PractiTest CSV into an Xray CSV file we can see that, as explained above, the Preconditions issues are created and linked back to the Tests. Each Test is created and the steps filled with the information extracted from the exported CSV.

Manual Tests in practitest_xray_results.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Issue Type,Precondition,Precondition Type,Description,Unstructured Definition,Gherkin Definition
2,,,Application is accessible and the main page is loaded ,,,,,precondition,,Manual,"Application is accessible and the main page is loaded

**Bold**

*Italic*

Bulllets:
1. one
2. two
3. three",,
3,,Manual,Login Validations,3,Access main page of the application,,The applciation main page appear with the option to login,Test,2,,"Validate manually that the login operation is working.

Make sure that:
* Login with valid user
* Login with invalid user
* Login with username (special characters)

**Bold**

*Italic*",,
3,,Manual,,3,"Insert ""Manuel"" in the username field",,"""Manuel"" appears in the usernam field",Test,,,,,
3,,Manual,,3,"Insert ""password"" in the password field",,The password is hidden in the password field (we can only see a serie of *),Test,,,,,
3,,Manual,,3,"Press the ""login"" button",,The application changes to a page where the user is logged in.,Test,,,,,
...


The first line corresponds to a precondition that is imported as described in the previous section.

The second line (after the precondition) corresponds to a Manual Test Case with the summary obtained from the CSV and several steps with Action and Expected Result.

Notice that the format is kept for the table and styles added in PractiTest.

Called tests in steps are not exported; PractiTest inserts an empty description when exported. The script inserts a step with the description: 'Test step imported from another test.'.


BDD Tests into Cucumber Test Case

PractiTest allows you to create BDD Test Cases with  a scenario definition.

The BDD test case in PractiTest is composed by one scenario field with the gherkin scenario and a description field. The CSV output is the following:

BDD Tests in practitest_export.csv
id,Name,Description,Status,Author,Run_status,Last Run,created at,updated at,Test_type,Tags,Preconditions,Value Score,Scenario,Automation candidate,Feature,Sub Feature,Test Level,Comments,Step name,Step description,Step expected_results,Step position,Traceability - Requirements,Traceability - Issues
...
3,BDD Test,"Description of the BDD Test
**Bold**
*Italic*

Bullet list:
1. one
2. two three",Draft,Cristiano Cunha,NO RUN,,09-Jan-2024  11:27,11-Jan-2024  11:17,BDDTest,"","",N/A,"Scenario: BDD Test
Given I access the main page of the application
When I click the listing link
Then I'm taken to the listing page",no,,,,"",Given ,I access the main page of the application,"",1,2,""
...


After running the script that converts the above PractiTest CSV into an Xray CSV file we can see that the Cucumber Test is created with the scenario definition extracted from the exported CSV.

Manual Tests in practitest_xray_results.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Issue Type,Precondition,Precondition Type,Description,Unstructured Definition,Gherkin Definition
...
6,,Cucumber,BDD Test,3,,,,Test,,,"Description of the BDD Test
**Bold**
*Italic*

Bullet list:
1. one
2. two three",,"Scenario: BDD Test
Given I access the main page of the application
When I click the listing link
Then I'm taken to the listing page"
...


The summary and description is kept with the style imported from PractiTest.

The imported test is of type 'Cucumber' and the scenario imported into the Scenario field in Xray.


Other Tests

The script will convert all tests of type Scripted or BDD; all the other types will be discarded, and no output is created in the resulting CSV file.



Tips

  • Use the CSV file provided to import the examples and the JSON configuration associated to have the setup and mapping correct.
  • Ensure you are using the scripts available for the right version of Jira (Cloud or Server).