Skip to content
SDETRole
SDETRole

Test Design & Dev Utilities

Gherkin Formatter and Linter

Indent .feature files, align tables and catch common mistakes.

Runs entirely in your browser No sign-up

Input .feature

1 lines

Formatted

Formatted output appears here.

Supports English Gherkin keywords. Line numbers in lint messages refer to your input.

About this tool

Feature files are read by product owners and developers as well as testers, so consistent layout matters. This formatter re-indents Feature, Rule, Background, Scenario, Scenario Outline and Examples blocks, places tags with the element they belong to, aligns the pipes in data tables and Examples tables, and leaves doc string content untouched apart from its base indentation. It also runs basic lint checks: scenarios with no Then step, duplicate scenario names, steps outside a scenario, Scenario Outlines without Examples, placeholders with no matching Examples column, uneven table rows and unclosed doc strings. It supports English keywords and runs entirely in your browser.

How to use it

  1. Paste the contents of a .feature file, or click “Load sample” to see a file with deliberate problems.
  2. Pick 2 or 4 spaces. The formatted, highlighted version appears on the right and lint results appear below with input line numbers.
  3. Copy or download the result, or click “Replace input with formatted” to keep editing the clean version.

Gherkin Formatter and Linter FAQ

Why is a scenario without a Then step flagged?

Then steps hold the assertions. A scenario that only has Given and When steps performs actions but verifies nothing, so it passes as long as nothing throws. The linter treats And and But after a Then as part of the Then block.

Does it change my step text?

No. It only changes indentation, collapses extra spaces between tags and pads table cells. Step wording, quoted parameters and doc string contents are preserved.

Are Examples allowed under a plain Scenario?

Since Gherkin 6, Scenario and Scenario Outline are interchangeable when an Examples table is present, and Cucumber runs it as an outline. The linter accepts both; placeholders such as <user> must still match an Examples column header.

Type to search across SDETRole.

Full-text search by Pagefind · runs in your browser Open search page →