Skip to content

BDD Project

A BDD project stores tests as Gherkin scenarios. Each suite is a .feature file, and each test is a scenario inside that file. A BDD project is a good fit when you:

  • write scenarios together with business, development, and QA teams,
  • use a Cucumber-based automation framework,
  • want your test scenarios to be closely connected to automation,
  • want to describe the starting state and expected result for each scenario.

A folder holds feature files, a feature file holds scenarios

In a BDD project, each suite is a .feature file. The scenarios inside the file are the tests.

Test overview in the BDD editor of Testomat.io UI

A feature file cannot contain another feature file, so a suite cannot contain other suites. Use folders to group feature files. Tests are organised like files in your code, so a manual test can become automated without moving it. See Suites and Folders to learn more.

BDD scenarios use Gherkin keywords such as Given, When, Then, and And. The BDD editor checks the Gherkin syntax as you type. If you misspell a keyword or miss a required line, the scenario cannot be saved as a valid test.

KeywordDescription
GivenThe starting state
WhenAn action
ThenThe expected result
AndAnother step added to the previous one

For example:

Feature: User Authentication
Scenario: Successful login with valid credentials
Given the user is on the Testomat.io login page
When the user enters valid credentials
And the user clicks the 'Sign In' button
Then the user should be redirected to the Project Dashboard
And a "Welcome" message should be displayed

You can keep an unfinished scenario as a draft. See Drafts for unfinished scenarios.

Syntax error message example in the Gherkin test

The same steps, such as Given I am on the login page, can be reused:

  1. Start typing the step.
  2. Pick it from the autocomplete list.

Reused steps have one big advantage: when a step changes, you edit it in one place and every scenario that uses it is updated.

See Steps Database for the full picture.

In a BDD project, each Gherkin step is connected to a step definition in your automation code. For reusable tests, describe what the user wants to do rather than the exact UI action.

For example:

When I cancel the transaction

is easier to reuse than:

When I click the red Cancel button

This also means your scenarios are less affected when the user interface changes.

To connect your scenarios to real code, import your feature files. See Import Cucumber BDD Tests.

Click a suite in the tree to open its page. This is where you see the feature file, its scenarios, and everything attached to it.

TabWhat it shows
Feature descriptionThe Feature text of the file.
TestsEvery scenario in the file.
AttachmentsFiles added to the suite.
RunsRuns that included these scenarios.
HistoryChanges made to the suite.

From this page you can also:

ControlWhat it does
EditOpens the feature file editor.
Set milestoneLinks the suite to a milestone, such as a sprint or a release.
Set labelsAdds labels or custom fields.
Set requirementsLinks the suite to a requirement document, so you can see what the scenarios are meant to cover. See AI-Requirements.
Suggest TestsLets AI propose new scenarios based on the suite description. See AI-Powered Features.
Add new testAdds a scenario without opening the editor. Type a title and click Create. Turn on Bulk to add several at once, one title per line.

A feature file is the suite in a BDD project. To open it:

  1. On the Tests page, click a suite in the tree.
  2. Click Edit in the top-right corner.

The editor opens with the Feature description and every scenario in the file.

#ControlWhat it does
1Go backReturn to the previous screen.
2CloseClose the editor.
3Set milestoneLink the feature file to a milestone, such as a sprint or a release.
4Set labelsAdd labels or custom fields.
5GherkinSwitch to the Gherkin view of the feature file.
6AutocompleteTurn step, snippet, and tag suggestions and the spell checker on or off.
7FullscreenOpen the editor in full-screen mode.
8AttachmentsAdd files to the feature file.
9Editing areaEdit the feature file and its Given/When/Then steps.
10FormatFormat the scenarios using the Gherkin structure. Shortcut: Cmd + B.
11SaveSave your changes. Open the arrow next to it for more save options.
12CancelLeave the editor without saving.

The Autocomplete menu holds four switches.

SwitchWhat it does
Autocomplete StepsSuggests steps from the Steps Database as you type. Pick one from the list to insert it.
Autocomplete SnippetsSuggests snippets - saved blocks of text or steps that you reuse across tests.
Autocomplete TagsSuggests existing tags after you type @, so you reuse a tag instead of creating a duplicate.
Spell checkMarks misspelled words in the editor as you type.

The feature file editor and scenario editor work with the same file. Changes made to a scenario are saved back to its feature file.

The scenario editor lets you edit the test without showing the rest of the feature file. You can open one scenario:

  1. Click a test in the tree.
  2. Click Edit.

The BDD scenario editor in edit mode, with the controls numbered

#ControlWhat it does
1Go backReturn to the previous screen.
2StateChange the test state, such as manual or automated.
3HelpOpen the help panel.
4Link to IssueLink the scenario to an issue in your bug tracker.
5CloseClose the editor.
6Set milestoneLink the scenario to a milestone, such as a sprint or a release.
7Set labelsAdd labels or custom fields.
8GherkinSwitch to the Gherkin view of the scenario.
9PrioritySet how important the scenario is.
10AutocompleteTurn step, snippet, and tag suggestions and the spell checker on or off.
11FullscreenOpen the editor in full-screen mode.
12AttachmentsAdd files to the scenario.
13Editing areaEdit the scenario and its Given/When/Then steps.
14SaveSave your changes. Open the arrow next to it for more save options.
15CancelLeave the editor without saving.

Open the arrow next to Save to see every save option:

OptionWhat it does
Save & View TestSaves and opens the test.
Save & Go To SuiteSaves and opens the feature file the scenario belongs to.
Save To Draft & View TestSaves your changes as a draft and opens the test.
Save & Close AllSaves and closes the editor.

Use Save To Draft & View Test to keep unfinished changes. The draft is saved, while the test keeps its last valid version.

When you open the test in edit mode again, you can use:

  • Apply Draft to Description to replace the current scenario text with the saved draft.
  • Delete Draft to remove the saved draft.

The Save to Draft and View Test option in the save menu

You can link a test or suite from another description by adding # before its ID. The # is a must in a BDD project.

For example:

#12345

To link by ID:

  1. Save the description. The ID becomes a clickable link.
  2. Click it to open the linked item in detail view.

A hash and a test ID into a scenario description, and the linked test opening in detail view