Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

To switch into Gherkin Text Editor Mode use the mode buttons in the footer section of the editor panel

image-20241001-112714.png

note that in the Data Center version of the app the mode buttons are located on the left and the Save & Cancel buttons on the right

Syntax Highlighting

Gherkin Keywords

All Gherkin keywords are highlighted using colour and bold font

image-20241001-112014.png

No '*'

Note that using * (asterisk character) as a step keyword is not supported as it does not improve readability of the examples

User Story Keywords

The commonly used set of user story keywords (As a, I want to, So that) can be entered in the Feature title section like below:

image-20240928-170258.png

In order to

Instead of “So that” you can use “In order to” so that you can start with the why

image-20241001-094117.png

User story keywords don’t need to be at the start of the line and you can use either lower or upper case as needed

image-20241001-094034.png

The 'to’ part in the “I want to“ keyword can be omitted and in the “As a” keyword you can enter either “As a“ or “As an

image-20241001-094308.png

Simple Step Parameters

Simple parameters (those that are on the same line as the step keyword) can be highlighted by simply wrapping them in single or double quotes

image-20241001-094952.png

Scenario Outline Parameters

<> delimited step parameters which are used as part of Scenario Template or Scenario Outline are highlighted automatically in orange

image-20241001-130625.png

Use autocomplete

Use autocompletion support to quickly populate Examples table header section with the names of the parameters that you have used in parameterized steps above. Simply press 'Ctrl+Space' to bring up the auto completion menu

image-20241001-130806.png

Scenario outline parameters are also supported inside tabular step parameters

image-20241001-142943.png

Doc String Step Parameters

Doc strings are highlighted in purple colour

image-20241001-135042.png

Backticks ```

The use of backtick characters instead of quotes is supported

image-20241001-135156.png

XML Step Parameters

If you enter 'xml' after the opening characters of a doc strings parameter then any XML that you enter before the closing doc strings characters is automatically syntax highlighted

image-20241001-135818.png

Tags

Tags are highlighted in grey colour

image-20241001-112249.png

Comments

Comments are highlighted in grey colour

image-20241001-143620.png

Fold comments

Comments spanning several lines can be conveniently folded using fold/unfold gutter icons

image-20241001-143744.png

Questions & Answers

A comment prefix character '#' is used followed by ‘Q:' or 'A:’ to highlight questions and answers respectively. Or the more elaborate version: “Question:“ and “Answer:”

image-20241001-150955.png

Tip - you can turn off the showing of gutter icons on the left via an editor menu option shown below

image-20241001-151149.png

Invalid text

If there is any text that according to the Cucumber Gherkin syntax does not belong to any of the Feature file elements, then it is underlined in red and an error icon is shown in the gutter

image-20241001-151652.png

Note that such errors to be highlighted the 'Errors' option in the Gutter options drop down menu must be turned on as shown below

image-20241001-151856.png

Autocomplete

Press keyboard shortcut Ctrl+Space or Alt+Click to bring up the autocomplete options menu.

Gherkin keywords

image-20241001-170504.png

Available options are dependent on where the cursor is currently positioned within the feature file.

image-20241001-154953.png

Tip - to quickly change the Step keyword simply hover over and do Alt+Click to show the autocomplete options menu. Picking an option will replace the already entered keyword that is temporarily highlighted in yellow.

image-20241001-163733.png

Examples table header

Inside the header row of an example table the autocomplete menu contains names of the scenario parameters that have been entered above using the <> step parameter syntax.

image-20241001-162646.png

Autocomplete can also be triggered if the cursor is inside the already entered column header text to easily replace the header value with another

image-20241001-162418.png

Autocomplete can also be triggered by placing the cursor after the last header column and pressing 'Ctrl+Space'

image-20241001-162049.png

Once the option is picked the autocomplete will also enter the necessary '|' divider characters for the new column and place the cursor in the next cell down

image-20241001-162014.png

If you need to rename a scenario parameter that you have already entered in several of the scenario steps, do it by updating the last occurrence that is in the Examples header section.

This way the other occurrences above will be updated automatically and momentarily highlighted in yellow as you type to indicate the automatic renaming.

image-20241001-161314.png

Auto Formatting

Correct line indentation

Spaces are used to indent relevant sections of a Feature according to the format rules of Gherkin. To correct indentation warnings, simply click the highlighted toolbar button. Clicking on the highlighted button while holding the Shift key will remove indentation from all lines.

image-20241001-194836.png

No Tabs
Note that using the Tab characters for indentation is not supported. Whenever you press the Tab key two spaces will be inserted instead.
If you are pasting Feature content from external editors, any Tabs that are pasted may lead to auto indentation not working.

Indent only selected lines
You can also selectively apply the indentation corrections to only the sections that have been selected

image-20241001-193259.png

Automatic alignment of tables

Columns in data tables used in step parameters as well as tables in the Examples sections are automatically aligned as you type

image-20241001-193744.png

Note that for the automatic alignment to work the editor option shown below must be turned on

image-20241001-194336.png

Remove trailing white space
To delete unnecessary white space from a table column, simply place the cursor at the end of the cell’s white space and press the Backspace key or double click to select the white space and press the Delete key.

image-20241001-193951.png

Syntax Checking

Any Gherkin syntax errors are automatically highlighted so that they could be easily corrected.

Out of order Gherkin keywords

Hovering over the highlighted error will give more details in a pop up message

image-20241001-171724.png

Missing data table header names

image-20241001-172347.png

Missing data table cells

image-20241001-173913.png

Missing Examples table value

image-20241001-172828.png

Unused Scenario parameter

image-20241001-173139.png

Duplicate Examples table column

image-20241001-173548.png

Incorrect indentation

A warning is shown for any lines that are not at expected indentation level according to Gherkin syntax

image-20241001-191155.png

Tip - to correct indentation of a data table, simply place the cursor before the leading cell of any of the rows and press Space or Tab key to adjust indentation of all rows together

image-20241001-191609.png

To unindent press Delete key or Shift+Tab

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.