What you'll learn

  • How to export test cases from Zephyr Scale
  • Use a script to convert the exported XML 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 Zephyr Scale and import them into Xray.

Zephyr Scale is a test management tool running in Jira with versions available on-premises and in the cloud. In this tutorial, you will learn how to export the test cases from Zephyr Scale in an XML format, how to use a script (available in GitHub) to convert the XML file into a 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 Zephyr Scale into Xray.

Features and Limitations

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

Migration from Zephyr Scale is limited by the information we can export from Zephyr Scale 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 Folders
  • Test case attachments
  • Test Cycles
  • Test Plans
  • Defects and Requirements


How it works

Zephyr Scale is an add-on that can be enabled in your Jira project and allows the users to specify and organize test cases into folders. Zephyr Scale has test cycles and plans; these concepts help the organization and execution of test cases. Depending on your testing goals, you can use one or another.

Zephyr Scale can create test cases in plain text, step-by-step, or using a BDD approach (with Gherkin). The test case using plain text allows the user to create a test case with a description only. The step-by-step test case allows the user to define multiple steps with step, test data, and expected result; in this type of tests, you can define a data set and use variables or call other test steps. The BDD approach enables the user to define scenarios in Gherkin.

In Zephyr Scale, to execute tests, you need to associate them to a test cycle.

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

Zephyr ScaleXrayComments
Test CaseTest

All three types of tests from Zephyr are imported into Xray.

The test case attachments are not exported using the XML export option in Zephyr Scale

Precondition

(Field in Test Case entity)

Precondition

(independent entity)

In Zephyr Scale, 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 Zephyr Scale is converted into a Precondition issue in Xray and linked back to the Test.

Test FolderTest Repository

The test folders and sub-folders of Zephyr Scale are mapped into Xray Test Repository.  




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 Zephyr Scale instance to export test cases in XML format
  • Access and usage of scripts to convert Zephyr Scale XML 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 XML file from Zephyr Scale, made the files available in GitHub, how to use the scripts to convert the XML 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 Zephyr Scale, using a combination of fields and possibilities that should cover most usages.

All of the examples in this tutorial have an XML file exported from Zephyr Scale, 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 XML from Zephyr Scale and Import into Xray

In Zephyr Scale when you choose to export using XML format, it will export the selected test cases. In this example, we are exporting all test cases.

To export from Zephyr Scale we are using the Export to XML option in the More upper menu entry in Zephyr Scale left menu.


Looking into more detail on what we have in Zephyr Scale, we can see that we have defined 2 folders:

  • Tests (with one sub-folder)
    • Regression Tests
  • Performance


Several test cases are defined, covering the different types available in Zephyr Scale. One behavior-driven development test case with one scenario in Gherkin, one plain text test case that describes the entire test in one description field. And several step-by-step test cases, using a dataset, re-using test cases, and using all the variations in the steps available (tables, images, different formats, etc.). All of the details of each case is described below.

The file generated by Zephyr Scale has the following content:

atm-exporter.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project>
    <projectId>10007</projectId>
    <projectKey>EWB</projectKey>
    <exportDate>2023-08-24 14:36:47 UTC</exportDate>
    <folders>
        <folder fullPath="Performance" index="1"/>
        <folder fullPath="Tests" index="0"/>
        <folder fullPath="Tests/Regression Tests" index="0"/>
    </folders>
    <testCases>
        <testCase id="98193130" key="EWB-T1">
            <attachments/>
            <component><![CDATA[Modules]]></component>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:28:31 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr first test case (Plain Text)]]></name>
            <objective><![CDATA[Zephyr test objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Zephyr precondition field]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="plain">
                <details><![CDATA[Description of the plain text test<br><br>Bullet list<ul><li><strong>one</strong></li><li><em>two</em> </li><li><u>three</u></li></ul><br>Table:<table style="width: 100.0%;"><tbody><tr><td style="width: 33.3333%;"><strong>Column1</strong></td><td style="width: 33.3333%;"><strong>column2</strong></td><td style="width: 33.3333%;"><strong>column3</strong></td></tr><tr><td style="width: 33.3333%;">cell1</td><td style="width: 33.3333%;">cell2</td><td style="width: 33.3333%;">cell3</td></tr></tbody></table><br>]]></details>
            </testScript>
        </testCase>
        <testCase id="98193720" key="EWB-T3">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:41:33 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr BDD Test Case]]></name>
            <objective><![CDATA[BDD Objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[BDD Precondition<br><br><strong>Bold</strong><br><em>Italic</em><br><br>Bullet<ul><li>one</li><li>two</li><li>three</li></ul><br><table style="width: 100.0%;"><tbody><tr><td style="width: 50.0%;">Column1</td><td style="width: 50.0%;">Column2</td></tr><tr><td style="width: 50.0%;">Cell1</td><td style="width: 50.0%;">Cell2</td></tr></tbody></table><br>]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="bdd">
                <details><![CDATA[Given browser is opened to login page
When user "<username>" logs in with password "<password>"
Then error page should be open

Examples:
    | username  | password |
    | invalid   |   mode   |
    | demo      | invalid  |
    | invalid   | invalid  |]]></details>
            </testScript>
        </testCase>
        <testCase id="98193533" key="EWB-T2">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:38:16 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests/Regression Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr second test case (Steps)]]></name>
            <objective><![CDATA[Test case steps objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Test case steps precondition]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="steps">
                <steps>
                    <step index="0">
                        <customFields/>
                        <description><![CDATA[Step one description]]></description>
                        <expectedResult><![CDATA[Step one Expected Result]]></expectedResult>
                        <testData><![CDATA[Step one test data]]></testData>
                    </step>
                    <step index="1">
                        <customFields/>
                        <description><![CDATA[Step two description<br><br><strong>Bold</strong><br><em>Italic</em><br><u>Underline</u><br><br><br>]]></description>
                        <expectedResult><![CDATA[Step two Expected result<br><br><strong>Bold</strong><br><em>Italic</em><br><u>Underline</u>]]></expectedResult>
                        <testData><![CDATA[Step two Test Data<br><br><strong><strong>Bold</strong><br></strong><em>Italic</em><strong><br></strong><u>Underline</u><br><br><br>]]></testData>
                    </step>
                    <step index="2">
                        <customFields/>
                        <description><![CDATA[Step three description<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></description>
                        <expectedResult><![CDATA[Step three Expected Result<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></expectedResult>
                        <testData><![CDATA[Step three test data<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></testData>
                    </step>
                    <step index="3">
                        <customFields/>
                        <description><![CDATA[Step four description<br><br>table<br><table style="width: 100.0%;"><tbody><tr><td style="width: 50.0%;">Column1</td><td style="width: 50.0%;">Column2<br></td></tr><tr><td style="width: 50.0%;">Cell1</td><td style="width: 50.0%;">Cell2</td></tr></tbody></table><br>]]></description>
                        <expectedResult><![CDATA[Step four Expected Result<br><br>table<br><table><tbody><tr><td>Column1</td><td>Column2<br></td></tr><tr><td>Cell1</td><td>Cell2</td></tr><tr><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td></tr></tbody></table><br>]]></expectedResult>
                        <testData><![CDATA[Step four test data<br><br>table<br><table><tbody><tr><td>Column1</td><td>Column2<br></td></tr><tr><td>Cell1</td><td>Cell2</td></tr></tbody></table><br>]]></testData>
                    </step>
                    <step index="4">
                        <customFields/>
                        <description><![CDATA[Step five description<br><br><img src="https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png" style="width: 182.0px;" class="fr-fil fr-dib">]]></description>
                        <expectedResult><![CDATA[Step five Expected Result<br><br>]]></expectedResult>
                        <testData><![CDATA[Step five test data<br><br><img src="https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png" class="fr-fic fr-dii"><br>]]></testData>
                    </step>
                </steps>
            </testScript>
        </testCase>
        <testCase id="98194957" key="EWB-T4" paramType="TEST_DATA">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:59:42 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests/Regression Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr Data Driven Test Case]]></name>
            <objective><![CDATA[Zephyr Data Driven Test Case Objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Zephyr Data Driven Test Case Precondition]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper>
                <testDataRow>
                    <testDataColumns>
                        <testData index="0">
                            <name><![CDATA[Username]]></name>
                            <type><![CDATA[FREE_TEXT_INPUT]]></type>
                            <value><![CDATA[John]]></value>
                        </testData>
                        <testData index="1">
                            <name><![CDATA[Password]]></name>
                            <type><![CDATA[FREE_TEXT_INPUT]]></type>
                            <value><![CDATA[Passwd1]]></value>
                        </testData>
                    </testDataColumns>
                </testDataRow>
                <testDataRow>
                    <testDataColumns>
                        <testData index="0">
                            <name><![CDATA[Username]]></name>
                            <type><![CDATA[FREE_TEXT_INPUT]]></type>
                            <value><![CDATA[Julie]]></value>
                        </testData>
                        <testData index="1">
                            <name><![CDATA[Password]]></name>
                            <type><![CDATA[FREE_TEXT_INPUT]]></type>
                            <value><![CDATA[Passwd2]]></value>
                        </testData>
                    </testDataColumns>
                </testDataRow>
            </testDataWrapper>
            <testScript type="steps">
                <steps>
                    <step index="0">
                        <customFields/>
                        <description><![CDATA[Access the main page]]></description>
                        <expectedResult><![CDATA[The main page is loaded]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="1">
                        <customFields/>
                        <description><![CDATA[Click on the login button]]></description>
                        <expectedResult><![CDATA[The login pop up appear]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="2">
                        <customFields/>
                        <description><![CDATA[Insert <var>Username</var> in the username input]]></description>
                        <expectedResult><![CDATA[The <var>Username</var> appear in the input]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="3">
                        <customFields/>
                        <description><![CDATA[Insert the <var>Password</var> in the password field]]></description>
                        <expectedResult><![CDATA[The <var>Password</var> appear in the password field]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="4">
                        <customFields/>
                        <description><![CDATA[Click on the Submit button]]></description>
                        <expectedResult><![CDATA[The user in the logged in state]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                </steps>
            </testScript>
        </testCase>
        <testCase id="98195185" key="EWB-T5" paramType="PARAMETER">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 11:08:07 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Performance]]></folder>
            <issues>
                <issue>
                    <key>EWB-444</key>
                    <summary><![CDATA[Ads plugin]]></summary>
                </issue>
                <issue>
                    <key>EWB-445</key>
                    <summary><![CDATA[Checkout feature]]></summary>
                </issue>
            </issues>
            <labels/>
            <name><![CDATA[Zephyr Test Case (Steps) Login]]></name>
            <objective><![CDATA[Manual steps for the authentication procedure]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[NA]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters>
                <parameter index="0">
                    <defaultValue><![CDATA[Michel]]></defaultValue>
                    <name><![CDATA[Username]]></name>
                </parameter>
                <parameter index="1">
                    <defaultValue><![CDATA[pwd123]]></defaultValue>
                    <name><![CDATA[Password]]></name>
                </parameter>
            </parameters>
            <testDataWrapper/>
            <testScript type="steps">
                <steps>
                    <step index="0">
                        <customFields/>
                        <description><![CDATA[Access main page]]></description>
                        <expectedResult><![CDATA[Main page is loaded and the login button is visible]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="1">
                        <customFields/>
                        <description><![CDATA[Click on the Login button]]></description>
                        <expectedResult><![CDATA[The login pop up appear]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="2">
                        <customFields/>
                        <description><![CDATA[Insert <var>Username</var> in the username field]]></description>
                        <expectedResult><![CDATA[The <var>Username</var> appears in the username field]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="3">
                        <customFields/>
                        <description><![CDATA[Insert <var>Password</var> in the password field]]></description>
                        <expectedResult><![CDATA[The <var>Password</var> appears in the password field]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="4">
                        <customFields/>
                        <description><![CDATA[Click on the Submit button]]></description>
                        <expectedResult><![CDATA[The user is in the logged in state]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                </steps>
            </testScript>
        </testCase>
        <testCase id="98196071" key="EWB-T6">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 11:18:17 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Performance]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr Modular test case (Login)]]></name>
            <objective><![CDATA[Zephyr modular test case objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Zephyr ModularTest Case precondition]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="steps">
                <steps>
                    <step index="0">
                        <customFields/>
                        <description><![CDATA[Access main page]]></description>
                        <expectedResult><![CDATA[Main page is loaded and the login button is visible]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="1">
                        <customFields/>
                        <description><![CDATA[Click on the Login button]]></description>
                        <expectedResult><![CDATA[The login pop up appear]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="2">
                        <customFields/>
                        <description><![CDATA[Insert <var>John</var> in the username field]]></description>
                        <expectedResult><![CDATA[The <var>John</var> appears in the username field]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="3">
                        <customFields/>
                        <description><![CDATA[Insert <var>passwd1</var> in the password field]]></description>
                        <expectedResult><![CDATA[The <var>passwd1</var> appears in the password field]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="4">
                        <customFields/>
                        <description><![CDATA[Click on the Submit button]]></description>
                        <expectedResult><![CDATA[The user is in the logged in state]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="5">
                        <customFields/>
                        <description><![CDATA[Click on the "Basket" button]]></description>
                        <expectedResult><![CDATA[User enter s the checkout area and all products saved are present.]]></expectedResult>
                        <testData><![CDATA[NA]]></testData>
                    </step>
                    <step index="6">
                        <customFields/>
                    </step>
                </steps>
            </testScript>
        </testCase>
    </testCases>
</project>



To import into Xray, we created one script to convert this XML file into a CSV-compatible file to be imported into Xray.
The script will parse the XML file and create a CSV file that can be imported into Xray. To execute the script, use the following command:

python3 zephyrscale2Xray.py -i atm-exporter.xml -o atm-exporter.csv


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

comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links
1,,,Zephyr precondition field,,,,,,,precondition,Manual,,,,,Zephyr precondition field,
2,,Manual,Zephyr first test case (Plain Text),2,,,,Tests,1,,,,,,,"Zephyr test objective
Description of the plain text test  
  
Bullet list* *one*
* _two_
* three

  
Table:


| *Column1* | *column2* | *column3* |
| cell1 | cell2 | cell3 |

  
",
3,,,BDD Precondition  ,,,,,,,precondition,Cucumber,,,,,"BDD Precondition  
  
*Bold*  
_Italic_  
  
Bullet* one
* two
* three

  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
",
4,,Cucumber,Zephyr BDD Test Case,3,,,,Tests,3,,,,,,"Given browser is opened to login page
When user ""<username>"" logs in with password ""<password>""
Then error page should be open

Examples:
    | username  | password |
    | invalid   |   mode   |
    | demo      | invalid  |
    | invalid   | invalid  |",BDD Objective,
5,,,Test case steps precondition,,,,,,,precondition,Manual,,,,,Test case steps precondition,
6,,Manual,Zephyr second test case (Steps),3,Step one description,Step one test data,Step one Expected Result,Tests/Regression Tests,5,,,,,,,Test case steps objective,
6,,Manual,,3,"Step two description  
  
*Bold*  
_Italic_  
Underline  
  
  
","Step two Test Data  
  
***Bold***_Italic_Underline  
  
  
","Step two Expected result  
  
*Bold*  
_Italic_  
Underline",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step three description  
  
Colors  
  
Blue  
Red","Step three test data  
  
Colors  
  
Blue  
Red","Step three Expected Result  
  
Colors  
  
Blue  
Red",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step four description  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
","Step four test data  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
","Step four Expected Result  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |
|  |  |
|  |  |

  
",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step five description  
  
[Link|https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png]","Step five test data  
  
[Link|https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png]  
","Step five Expected Result  
  
",,,,,,,,,Test case steps objective,
7,,,Zephyr Data Driven Test Case Precondition,,,,,,,precondition,Manual,,,,,Zephyr Data Driven Test Case Precondition,
8,,Manual,Zephyr Data Driven Test Case,4,Access the main page,NA,The main page is loaded,Tests/Regression Tests,7,,,,,,,Zephyr Data Driven Test Case Objective,
8,,Manual,,3,Click on the login button,NA,The login pop up appear,,,,,,,,,Zephyr Data Driven Test Case Objective,
8,,Manual,,3,Insert Username in the username input,NA,The Username appear in the input,,,,,,,,,Zephyr Data Driven Test Case Objective,
8,,Manual,,3,Insert the Password in the password field,NA,The Password appear in the password field,,,,,,,,,Zephyr Data Driven Test Case Objective,
8,,Manual,,3,Click on the Submit button,NA,The user in the logged in state,,,,,,,,,Zephyr Data Driven Test Case Objective,
9,,,NA,,,,,,,precondition,Manual,,,,,NA,
10,,Manual,Zephyr Test Case (Steps) Login,3,Access main page,NA,Main page is loaded and the login button is visible,Performance,9,,,,,,,Manual steps for the authentication procedure,EWB-444;EWB-445
10,,Manual,,3,Click on the Login button,NA,The login pop up appear,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Insert Username in the username field,NA,The Username appears in the username field,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Insert Password in the password field,NA,The Password appears in the password field,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Click on the Submit button,NA,The user is in the logged in state,,,,,,,,,Manual steps for the authentication procedure,
11,,,Zephyr ModularTest Case precondition,,,,,,,precondition,Manual,,,,,Zephyr ModularTest Case precondition,
12,,Manual,Zephyr Modular test case (Login),3,Access main page,NA,Main page is loaded and the login button is visible,Performance,11,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,Click on the Login button,NA,The login pop up appear,,,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,Insert John in the username field,NA,The John appears in the username field,,,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,Insert passwd1 in the password field,NA,The passwd1 appears in the password field,,,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,Click on the Submit button,NA,The user is in the logged in state,,,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,"Click on the ""Basket"" button",NA,User enter s the checkout area and all products saved are present.,,,,,,,,,Zephyr modular test case objective,
12,,Manual,,3,,,,,,,,,,,,Zephyr modular test case objective,


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).

Choose the Project into which you want to import the Tests and select the option to create the Test Repository folders, as shown below.


When the import operation is complete, you can download the operation details, save the configuration for future use, or check the created issues.

When you click over the link to see the imported issues, we can see that it has created twelve issues, six Preconditions and six 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 Zephyr Scale Preconditions are another field in the Test that allows tables, different styles and multiline. 


The precondition is exported in a 'precondition' field within the 'testCase' as we can see below. 

precondition in comic_estore.xml
...
<testCase id="98193720" key="EWB-T3">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:41:33 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr BDD Test Case]]></name>
            <objective><![CDATA[BDD Objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[BDD Precondition<br><br><strong>Bold</strong><br><em>Italic</em><br><br>Bullet<ul><li>one</li><li>two</li><li>three</li></ul><br><table style="width: 100.0%;"><tbody><tr><td style="width: 50.0%;">Column1</td><td style="width: 50.0%;">Column2</td></tr><tr><td style="width: 50.0%;">Cell1</td><td style="width: 50.0%;">Cell2</td></tr></tbody></table><br>]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
...


When converting into a CSV for Xray, we are creating a new issue of type 'precondition' where we convert the exported HTML of the precondition element into Jira markup to preserve (most) the styles and elements.

Text with color or underline are two styles that we cannot import into Xray, the content will be there but without the style.


The next line links the precondition to the Test.

Precondition in comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links
...
3,,,BDD Precondition  ,,,,,,,precondition,Cucumber,,,,,"BDD Precondition  
  
*Bold*  
_Italic_  
  
Bullet* one
* two
* three

  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
",
4,,Cucumber,Zephyr BDD Test Case,3,,,,Tests,3,,,,,,"Given browser is opened to login page
When user ""<username>"" logs in with password ""<password>""
Then error page should be open

Examples:
    | username  | password |
    | invalid   |   mode   |
    | demo      | invalid  |
    | invalid   | invalid  |",BDD Objective,
...


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

The Precondition summary in Xray is extracted from the precondition field of Zephyr Scale, we extract a maximum of 254 characters or until the first newline (summaries in Jira do not allow newline).

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

Test Folder into Test Repository

In Zephyr Scale we can organize our tests into folders and subfolders as we can see below:

As we can see in the above picture we have:

  • one section called 'Tests' with 2 tests and a sub-section 'Regression Tests' with two tests
  • one section called 'Performance' with two tests

Zephyr Scale folders and sub-folders are exported into the XML file using the folder element in the following form:

test section in atm-exporter.xml
		...
		<testCase id="98193720" key="EWB-T3">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:41:33 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
			...
		<testCase id="98193533" key="EWB-T2">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:38:16 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests/Regression Tests]]></folder>
            <issues/>
            <labels/>
			...
		<testCase id="98195185" key="EWB-T5" paramType="PARAMETER">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 11:08:07 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Performance]]></folder>
            <issues>
		...


After running the script that converts the XML file into a CSV format, we can see that it adds, in the Test Repo field, the Test Repository name to be created when uploading the file into Xray.

Test Repo in comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links
...
6,,Manual,Zephyr second test case (Steps),3,Step one description,Step one test data,Step one Expected Result,Tests/Regression Tests,5,,,,,,,Test case steps objective,
...
8,,Manual,Zephyr Data Driven Test Case,4,Access the main page,NA,The main page is loaded,Tests/Regression Tests,7,,,,,,,Zephyr Data Driven Test Case Objective,
...


After importing into Xray, we can see that new directories were created in the Test Repository:

Traceability Issues into Requirement references

Zephyr Scale allows you to insert linked issues in the Traceability  tab under Coverage, as we can see below:


Any test case from Zephyr Scale that has these references are exported into the XML into a issues field that can be composed by several issues. The exported XML has the following output:

Manual Tests in atm-exporter.xml
...
<testCase id="98195185" key="EWB-T5" paramType="PARAMETER">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 11:08:07 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Performance]]></folder>
            <issues>
                <issue>
                    <key>EWB-444</key>
                    <summary><![CDATA[Ads plugin]]></summary>
                </issue>
                <issue>
                    <key>EWB-445</key>
                    <summary><![CDATA[Checkout feature]]></summary>
                </issue>
            </issues>
            <labels/>
            <name><![CDATA[Zephyr Test Case (Steps) Login]]></name>
            <objective><![CDATA[Manual steps for the authentication procedure]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[NA]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
...


After running the script we have the referenced issues in the Links field separated by ";". The CSV output is the following:

Manual Tests in comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links
...
10,,Manual,Zephyr Test Case (Steps) Login,3,Access main page,NA,Main page is loaded and the login button is visible,Performance,9,,,,,,,Manual steps for the authentication procedure,EWB-444;EWB-445
10,,Manual,,3,Click on the Login button,NA,The login pop up appear,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Insert Username in the username field,NA,The Username appears in the username field,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Insert Password in the password field,NA,The Password appears in the password field,,,,,,,,,Manual steps for the authentication procedure,
10,,Manual,,3,Click on the Submit button,NA,The user is in the logged in state,,,,,,,,,Manual steps for the authentication procedure,
...

Once imported into Xray, the issues are added into the Linked issues.

Make sure that you have the right permissions to link the issues referenced otherwise the import will fail.


Manual Tests (With Steps separated and in Text) into Manual Test Case

Zephyr Scale allows you to create Manual Test Cases with steps (using steps, test data, and expected results) or using only a text field to describe the test.

We have created one test case using the steps in a text field and one using the steps separated into fields. The XML output is the following:

Manual Tests in atm-exporter.xml
...
    <testCases>
        <testCase id="98193130" key="EWB-T1">
            <attachments/>
            <component><![CDATA[Modules]]></component>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:28:31 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr first test case (Plain Text)]]></name>
            <objective><![CDATA[Zephyr test objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Zephyr precondition field]]></precondition>
            <priority><![CDATA[High]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="plain">
                <details><![CDATA[Description of the plain text test<br><br>Bullet list<ul><li><strong>one</strong></li><li><em>two</em> </li><li><u>three</u></li></ul><br>Table:<table style="width: 100.0%;"><tbody><tr><td style="width: 33.3333%;"><strong>Column1</strong></td><td style="width: 33.3333%;"><strong>column2</strong></td><td style="width: 33.3333%;"><strong>column3</strong></td></tr><tr><td style="width: 33.3333%;">cell1</td><td style="width: 33.3333%;">cell2</td><td style="width: 33.3333%;">cell3</td></tr></tbody></table><br>]]></details>
            </testScript>
        </testCase>
			...
<testCase id="98193533" key="EWB-T2">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:38:16 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests/Regression Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr second test case (Steps)]]></name>
            <objective><![CDATA[Test case steps objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[Test case steps precondition]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="steps">
                <steps>
                    <step index="0">
                        <customFields/>
                        <description><![CDATA[Step one description]]></description>
                        <expectedResult><![CDATA[Step one Expected Result]]></expectedResult>
                        <testData><![CDATA[Step one test data]]></testData>
                    </step>
                    <step index="1">
                        <customFields/>
                        <description><![CDATA[Step two description<br><br><strong>Bold</strong><br><em>Italic</em><br><u>Underline</u><br><br><br>]]></description>
                        <expectedResult><![CDATA[Step two Expected result<br><br><strong>Bold</strong><br><em>Italic</em><br><u>Underline</u>]]></expectedResult>
                        <testData><![CDATA[Step two Test Data<br><br><strong><strong>Bold</strong><br></strong><em>Italic</em><strong><br></strong><u>Underline</u><br><br><br>]]></testData>
                    </step>
                    <step index="2">
                        <customFields/>
                        <description><![CDATA[Step three description<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></description>
                        <expectedResult><![CDATA[Step three Expected Result<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></expectedResult>
                        <testData><![CDATA[Step three test data<br><br>Colors<br><br><span style="color: rgb(44,130,201);">Blue</span><br><span style="color: rgb(184,49,47);">Red</span>]]></testData>
                    </step>
                    <step index="3">
                        <customFields/>
                        <description><![CDATA[Step four description<br><br>table<br><table style="width: 100.0%;"><tbody><tr><td style="width: 50.0%;">Column1</td><td style="width: 50.0%;">Column2<br></td></tr><tr><td style="width: 50.0%;">Cell1</td><td style="width: 50.0%;">Cell2</td></tr></tbody></table><br>]]></description>
                        <expectedResult><![CDATA[Step four Expected Result<br><br>table<br><table><tbody><tr><td>Column1</td><td>Column2<br></td></tr><tr><td>Cell1</td><td>Cell2</td></tr><tr><td><br></td><td><br></td></tr><tr><td><br></td><td><br></td></tr></tbody></table><br>]]></expectedResult>
                        <testData><![CDATA[Step four test data<br><br>table<br><table><tbody><tr><td>Column1</td><td>Column2<br></td></tr><tr><td>Cell1</td><td>Cell2</td></tr></tbody></table><br>]]></testData>
                    </step>
                    <step index="4">
                        <customFields/>
                        <description><![CDATA[Step five description<br><br><img src="https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png" style="width: 182.0px;" class="fr-fil fr-dib">]]></description>
                        <expectedResult><![CDATA[Step five Expected Result<br><br>]]></expectedResult>
                        <testData><![CDATA[Step five test data<br><br><img src="https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png" class="fr-fic fr-dii"><br>]]></testData>
                    </step>
                </steps>
            </testScript>
        </testCase>
...


After running the script that converts this XML into a 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 XML.

Manual Tests in comic_estore.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links
1,,,Zephyr precondition field,,,,,,,precondition,Manual,,,,,Zephyr precondition field,
2,,Manual,Zephyr first test case (Plain Text),2,,,,Tests,1,,,,,,,"*Objective*: Zephyr test objective
2,,Manual,Zephyr first test case (Plain Text),2,,,,Tests,1,,,,,,,"*Objective*: Zephyr test objective
*Details*: Description of the plain text test  
  
Bullet list  
  
* *one*
* _two_
* three

  
Table:  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
More description of the Test Case.",
...
5,,,Test case steps precondition,,,,,,,precondition,Manual,,,,,Test case steps precondition,
6,,Manual,Zephyr second test case (Steps),3,Step one description,Step one test data,Step one Expected Result,Tests/Regression Tests,5,,,,,,,Test case steps objective,
6,,Manual,,3,"Step two description  
  
*Bold*  
_Italic_  
Underline  
  
  
","Step two Test Data  
  
***Bold***_Italic_Underline  
  
  
","Step two Expected result  
  
*Bold*  
_Italic_  
Underline",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step three description  
  
Colors  
  
Blue  
Red","Step three test data  
  
Colors  
  
Blue  
Red","Step three Expected Result  
  
Colors  
  
Blue  
Red",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step four description  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
","Step four test data  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |

  
","Step four Expected Result  
  
table  



| Column1 | Column2 |
| Cell1 | Cell2 |
|  |  |
|  |  |

  
",,,,,,,,,Test case steps objective,
6,,Manual,,3,"Step five description  
  
[Link|https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png]","Step five test data  
  
[Link|https://smartbear-tm4j-prod-us-west-2-attachment-rich-text.s3.us-west-2.amazonaws.com/embedded-80a83e8ee105d2b385c6087100adf4f43f8fd13a255b2528cf8ace53be7703e3-1692614231114-image2023-3-15_17-10-45.png]  
","Step five Expected Result  
  
",,,,,,,,,Test case steps objective,
...


The first Test corresponds to a Manual Test Case with the summary obtained from the CSV, and the description combines the objective and the description extracted from the CSV.

In Zephyr Scale the test described in plain text does not have steps so the Test in Xray will be a manual step without any steps defined. 

The second Test has one line per each step. Notice that the format is kept for the table and styles added in Zephyr Scale.

Modular test case from Zephyr Scale are exported with the steps unfolded and with no reference to the original test case. 

Tests with data sets defined in Zephyr scale are imported without the data set.

BDD Tests into Cucumber Test Case

Zephyr also allows the creation of BDD test cases, this type define a scenario in Gherkin as we can see in the exported XML file below.

Exploratory Test in comic_estore.xml
...
<testCase id="98193720" key="EWB-T3">
            <attachments/>
            <confluencePageLinks/>
            <createdBy>Cristiano Cunha</createdBy>
            <createdOn>2023-08-21 10:41:33 UTC</createdOn>
            <customFields/>
            <folder><![CDATA[Tests]]></folder>
            <issues/>
            <labels/>
            <name><![CDATA[Zephyr BDD Test Case]]></name>
            <objective><![CDATA[BDD Objective]]></objective>
            <owner>6064569b352e1e0069ef5bfa</owner>
            <precondition><![CDATA[BDD Precondition<br><br><strong>Bold</strong><br><em>Italic</em><br><br>Bullet<ul><li>one</li><li>two</li><li>three</li></ul><br><table style="width: 100.0%;"><tbody><tr><td style="width: 50.0%;">Column1</td><td style="width: 50.0%;">Column2</td></tr><tr><td style="width: 50.0%;">Cell1</td><td style="width: 50.0%;">Cell2</td></tr></tbody></table><br>]]></precondition>
            <priority><![CDATA[Normal]]></priority>
            <status><![CDATA[Draft]]></status>
            <parameters/>
            <testDataWrapper/>
            <testScript type="bdd">
                <details><![CDATA[Given browser is opened to login page
When user "<username>" logs in with password "<password>"
Then error page should be open

Examples:
    | username  | password |
    | invalid   |   mode   |
    | demo      | invalid  |
    | invalid   | invalid  |]]></details>
            </testScript>
...


After converting the above file using the available script we get the following output:

BDD Test in atm-exporter.csv
Issue ID,Issue Key,Test Type,Test Summary,Test Priority,Action,Data,Result,Test Repo,Precondition,Issue Type,Precondition Type,Unstructured Definition,Labels,Component,Gherkin definition,Description,Links

...
4,,Cucumber,Zephyr BDD Test Case,3,,,,Tests,3,,,,,,"Given browser is opened to login page
When user ""<username>"" logs in with password ""<password>""
Then error page should be open

Examples:
    | username  | password |
    | invalid   |   mode   |
    | demo      | invalid  |
    | invalid   | invalid  |",BDD Objective,
...


Importing into Xray will create a Cucumber Test and add the objective into the Description field.


Other Tests

The script will convert all tests of type Plain TextStep-by-Step, or BDD-Gherkin; all the other types will be discarded, and no output will be created in the resulting CSV file.




Tips

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