Gherkin Writing & Scenario Design
- Gherkin anatomy: Feature, Background, Scenario, Given/When/Then, And, But
- Scenario quality: business-readable, implementation-independent, concrete examples
- Scenario Outline with Examples tables: data-driven scenarios
- Tags: @smoke, @regression, @wip — filtering test execution
- Background: shared preconditions without repeating Given steps
- Writing Given steps that set up state — not UI interactions
- When steps: single user action per scenario
- Then steps: observable outcomes, not internal assertions
- Example Mapping workshop: discovering scenarios before writing code
- Common mistakes: imperative vs declarative style, testing UI through Cucumber, giant step definitions
Step Definitions & Spring Integration
- Step definition anatomy: regex vs Cucumber expressions, parameter types
- World object: sharing state between steps
- Hooks: @Before, @After, @BeforeStep — setup and teardown
- Custom parameter types: mapping Gherkin strings to domain objects
- Cucumber with Spring: @CucumberContextConfiguration, @SpringBootTest, context caching
- Cucumber with Testcontainers: real databases in acceptance tests
- Page Object pattern for UI scenarios: separating navigation from assertions
- Reporting: Cucumber HTML reports, Allure integration
- Running Cucumber in CI: JUnit Platform integration, filtering by tag
- Living documentation: publishing Cucumber reports for stakeholders
Teams who write Cucumber scenarios that are genuinely readable by non-developers, maintainable by developers, and valuable as regression coverage — not just passing green checks nobody trusts.
- Write declarative Gherkin scenarios that describe behaviour without leaking implementation
- Structure step definitions cleanly with proper state sharing and hooks
- Integrate Cucumber with Spring Boot for full-stack acceptance testing
- Run tagged scenario subsets in CI and publish human-readable reports
Book the Cucumber / Gherkin training
Works best as a combined session with developers, testers, and product owners — the three-amigos format makes the most of the training.
Get in touch