Cucumber .feature files can be exported from Xray and executed externally. They can be generated from the following Xray issues:

Or, from an Issue mapped as a Requirement issue type.

If the language defined to export the cucumber .feature files is not the default (i.e., En), then a language tag will be added.

Rules

Xray generates Cucumber .feature files according to the context issue and the following rules. The global setting "Generate features by requirements" affects how feature files are generated. If this setting is disabled, Xray will ignore the connection between Requirements and Tests.

Considering Requirements associated with Tests ("Generate features by requirements" setting is enabled)

Test
Test Set, Test Execution, Test Plan or Requirement issue

Ignoring Requirements associated with Tests ("Generate features by requirements" setting is disabled)

Test
Test Set, Test Execution, Test Plan or Requirement issue


Feature File Format


[ #language: { language } ]
[ @{ Test Execution issue Key } ]

[ @{ Requirement issue Key } ]
Feature: [{ Requirement Issue Summary }]
    [{ Requirement Issue Description }]
     
    [Background:
        { Pre-Conditions }]
     
    [# { Test Issue Description }]
    @{ Test Issue Key } 
    [@{ SubRequirement Issue Key 1 } ... @{ SubRequirement Issue Key N }] 
    [@{ Test Set Issue Key 1 } ... @{ Test Set Issue Key N }] 
    [@{ Test Issue Label 1 } ... @{ Test Issue Label N}]
    Scenario [Outline]: { Test Issue Summary }
        {Test Issue Steps}
    ...


Feature File Naming Convention


<sequential_id_one_based>[_<issue_requirement_key>][_<issue_precondition_key>]


Example

Exporting a Test Execution with the following Tests:

Key

Requirement

Pre-Condition

T1R1C1
T2R1-
T3-C2
T4R2C1
T5R2C3
T6--
T7R2, R3C1
T8R2, R3-
T9

-

C2
T10R1C1

generates the following 9 feature files when the "Generate features by requirements" setting is enabled:

File

Requirements

Pre-Condition

Tests

Filename

1R1C1T1, T101_R1_C1.feature
2R1-T22_R1.feature
3R2C1T4, T73_R2_C1.feature
4R2C3T54_R2_C3.feature
5R2-T85_R2.feature
6R3-T86_R3.feature
7R3C1T77_R3_C1.feature
8-C2T3, T98_C2.feature
9--T69.feature

and will also generate the following feature files when the "Generate features by requirements" setting is disabled:

File

Pre-Condition

Tests

Filename

1C1T1, T4, T7, T101_C1.feature
2C2T3, T92_C2.feature
3C3T53_C3.feature
4-T2, T6, T84.feature

Feature Name

The 'feature name' can be defined in the Xray miscellaneous, and we have the option to choose from the following:

Examples:

Case A: Requirement REQ-A with tests TEST-A, and TEST-B that have other requirements e.g. REQ-B

Case B: Test-C  without requirement

Expected results when the "Generate features by requirements" setting is enabled:


Requirement KeyRequirement Key in each req fileAll respective requirement keys in each req fileDEFAULT
Requirement SummaryRequirement Summary in each req fileAll respective requirement summaries in each req fileDEFAULT
Test KeyAll respective test keys in each req fileTest Key in each req fileTEST-C Key
Test SummaryAll respective test summaries in each req fileTest Summary in each req fileTEST-C Summary
Old versionsRequirement Summary in each req fileRequirement Summary in each req fileDEFAULT


Expected results when the "Generate features by requirements" setting is disabled:


Requirement KeyREQ-A KeyREQ-A, REQ-B KeysDEFAULT
Requirement SummaryREQ-A SummaryREQ-A, REQ-B SummariesDEFAULT
Test KeyTEST-A, TEST-B KeysTEST-A KeyTEST-C Key
Test SummaryTEST-A, TEST-B SummariesTEST-A SummaryTEST-C Summary
Old versionsDEFAULTDEFAULTDEFAULT