Gherkin and the TestZeus dialect
Gherkin is a plain-text, line-oriented language used to describe software
behavior without detailing how that behavior is implemented. It is the language
business-readable test scenarios are written in, and it is the language TestZeus
uses for every test case: each test begins with the word Feature: followed by
one or more Scenario: blocks written in Given/When/Then form.
It's worth separating two things that often get blurred together: the core
Gherkin/Cucumber keywords that are part of the general Gherkin specification,
and the additional conventions TestZeus layers on top of them (like
quoted-vs-unquoted matching, or the ;skip; comment marker).
Why Gherkin
- Readable by anyone — product managers, business analysts, and QA can all read (and often write) a Gherkin scenario without knowing how to code.
- It forces a clear structure — setup (Given), action (When), and expected result (Then) — which keeps test cases focused on one behavior at a time.
- It parses reliably — because it's structured text and not code, an AI agent (like TestZeus's) can parse it and translate each line into real UI actions or API calls.
Standard Gherkin keywords
These keywords are the core of Gherkin as a language (independent of TestZeus) and are the ones used throughout this guide's examples.
| Keyword | Purpose |
|---|---|
Feature |
Names the capability or area under test. One feature per test file. |
Scenario |
Describes one concrete example/situation to verify. A feature can have many scenarios. |
Given |
Sets up the starting state/context (e.g. a user is logged in). |
When |
Describes the action being performed (e.g. a button is clicked). |
Then |
States the expected outcome (e.g. a confirmation message appears). |
And / But |
Chains additional steps to the previous keyword without repeating Given/When/Then. |
How TestZeus handles broader Gherkin constructs
- Supported keywords:
Feature,Scenario,Given,When,Then,And,But. - Comments: supported via
#(standard) and;skip;(TestZeus dialect). - Tags (
@tag): supported through the platform UI Tags panel above the editor rather than inline step text. - Data tables / variables: handled via attached Test Data datasets and
[variable_name]references instead of inline Markdown pipe tables. - Unsupported constructs:
Background,Scenario Outline,Examples,Rule, and Doc Strings are not natively parsed.
IMPORTING .FEATURE FILES
For imported .feature files using unsupported constructs, scenarios should be
flattened into standard linear Feature/Scenario format before importing.
A basic example
This mirrors the structure seen in the TestZeus Tests editor (an account-creation scenario):
Feature: Account creation using UI
Scenario: User creates a new Account via UI
Given I am logged into "URL"
And I navigate to "Accounts" from the App Launcher
And I click on the New button
And I enter the Account Name as "TestAccount" and append the current timestamp
And I click on the Save button
Then I should see a confirmation message for successful account creationTestZeus-specific conventions
These are not part of standard Gherkin — they're conventions TestZeus itself adds on top of it, visible directly in the example above.
- Quoted text is literal. Text in double quotes (e.g.
"Accounts","URL") is treated as a literal value TestZeus should look for or type — a field label, button name, or URL. - Unquoted text is flexible. Text that isn't quoted (e.g.
New button) is matched loosely — TestZeus will accept close matches such as "New" or "NEW". - Two comment syntaxes.
#(standard Gherkin) is the native comment marker recognized by TestZeus and standard Cucumber tools.;skip;(TestZeus dialect extension) is a TestZeus-specific keyword used at the start of a line to explicitly instruct the execution engine to skip that line during execution. Both are useful for leaving instructions or notes inside a test file without affecting the run. - Natural-language instructions can be embedded directly in a step, e.g. "enter the Account Name as TestAccount and append the current timestamp" — TestZeus's AI resolves what that means at run time (in this case, generating a unique value), rather than requiring a hard-coded value.
Gherkin best practices
- One scenario should test one behavior — keep scenarios short and focused so failures are easy to diagnose.
- Write steps from the user's point of view, not the system's ("I click Save", not "the
saveButton.onClick()fires"). - Keep hard-coded values out of the Gherkin text where possible — URLs, credentials, and test records belong in attached Test Data, so the same scenario can be re-run against different data or environments.
- Use each keyword for its purpose —
Givenfor state/setup,Whenfor the action under test, andThenonly for assertions/expected outcomes. Avoid mixing actions into aThenstep.