---
title: "Gherkin"
canonical: "https://docs.getxray.app/space/XRAYCLOUD/44565320/Gherkin"
format: markdown
---
> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

Cucumber is a tool that executes plain-text functional descriptions as automated Tests. The language Cucumber understands is called Gherkin, a business-readable, domain-specific language that describes software behavior without detailing how that behavior is implemented. It is a line-oriented language that uses indentation to define structure. Line endings terminate statements (e.g., [Steps](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565316)). Either spaces or tabs may be used for indentation (spaces are more portable). Most lines start with a keyword.

# Fields

Gherkin Tests are divided into two **Scenario Types**:

- ** Scenario:** a set of instructions exclusively composed of constant values, which, when executed by a tool, will only give a static result (e.g., 2 + 3 = 5).
- ** Scenario Outline:** a generic set of instructions containing variables, which, when executed by a tool, will prompt varied results according to the specified input.

These Scenario Types are inferred from the **Scenario** specification (Figure 1 - 1), i.e., the behavior to be reproduced by the Cucumber tool is entered in the Steps field.

![Figure 1 - Scenario](media://6abd40fb-c7ec-4e61-a2d5-1048e66f1aba)

# Scenario Operations

## Editing the Scenario Description

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Test Work Item (Cucumber) you want to edit.
> 
> > Macro (rw-step)
> 
> To edit a scenario, click the scenario description editor (Figure 2 - 1) to enter edit mode. The edit mode is easily identified by its grey background color and the appearance of the *Save* ✓ and *Cancel x* icons at the bottom of the textbox (Figure 2 - 2). Gherkin keyword suggestions are displayed if you press the `^CTRL` + `Space` keys (Figure 2 - 3). 
> 
> ![Figure 2 - Editing](media://798a6e1f-eacc-4a2a-a16e-8ffd034c8a01)
> 
> > Macro (rw-step)
> 
> After having the Step keywords, **BDD Step suggestions** are also displayed if you press the `^CTRL` + `Space` keys (Figure 3 - 1). These suggested BDD Steps come from the existing BDD Steps in the <u>[project's BDD steps library](https://docs.getxray.app/space/XRAYCLOUD/44577261)</u>.
> 
> ![Figure 3 - Editing](media://5fab2715-16c5-4de0-9dee-d9c6553c420d)
> 
> > Macro (rw-step)
> 
> Once you are done editing the scenario description, click the *Save* button (Figure 2 - 2).
> 
> > ℹ️ If the inserted scenario description is **invalid Gherkin syntax**, it will still be saved as it is, but a warning message will be displayed next to the editor when in view mode (Figure 4).
> > ℹ️ 
> > ℹ️ ![Figure 4 - Invalid](media://1f5aa8e3-de67-4f16-9f09-e6a5bbecd506)

## Exporting a Cucumber Test Work Item

Cucumber Tests in Jira can be exported to feature files ready to be executed in Cucumber. The generated feature files follow the rules defined in [Export Cucumber Features](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565307) and take into account the context of the Jira Test Work Item.

This action will prompt the generation and download of a FeatureBundle ZIP file containing a single Cucumber feature file for every Requirement associated with the target Test.

> ℹ️ You can only export a Cucumber Test Issue if the Test Type is *Cucumber* (Figure 5 - 3).

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> Go to the Test Work Item (Cucumber Type) you wish to export.
> 
> > Macro (rw-step)
> 
> Click the ellipsis icon (Figure 5 - 1) and then select the *Xray - Generate Cucumber files* option (Figure 5 - 2).
> 
> ![Figure 5 - Exporting](media://b47c5c5d-50b7-4367-a3f2-e56fa9bea140)
> 
> > Macro (rw-step)
> 
> A modal (Figure 6) will open for you to confirm the ZIP file download. Once you click *Download* (Figure 6 - 1), you will get the file on your machine.
> 
> ![Figure 6 - Download](media://154a909c-0233-4892-9f4c-c3fbf6d0e278)


<details>
<summary>Support/Troubleshooting</summary>

If you have questions or technical issues, please [contact the Support team via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) or [send us a message using the in-app chat](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44577312).
</details>