#1 India's Top IT Training Institute

On Demand Courses

9 programs

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Automation Testing Cucumber Guide
PDF Downloads

Download the Cucumber BDD guide PDF from Uncodemy: Gherkin, feature files, step definitions, scenario outlines, hooks and tags.

Prepared by: Uncodemy trainer team Reviewed by: Uncodemy Last reviewed: 26 Oct 2026
Cucumber at a Glance
1
GherkinFeature, Background, Scenario, Given/When/Then, tags.
2
Feature filesReadable specs that business and tech can both understand.
3
Step definitionsJava methods matched to each Gherkin step.
4
Scenario OutlineA template scenario run with several data rows.
5
Hooks & tags@Before / @After for setup; tags to filter subsets.
6
Collaboration firstThe value is mostly in the conversation.

Quick Answer

This page offers Uncodemy's Cucumber guide as a PDF download. Cucumber supports behaviour-driven development by letting teams write tests in plain language that business people can read, and then linking each step to automation code. The guide covers Gherkin, feature files, step definitions, scenario outlines, hooks and tags.

Download

Cucumber Guide PDFs

Three quick-access entry points into the same Cucumber BDD guide PDF: the full guide, the feature file + step definition code pack, and the Gherkin good vs weak wording reference. All PDFs on this page are free to download. No form is required.

3 PDFs Available
PDF 01 Main Guide

Automation Testing Cucumber Guide

The complete guide to Cucumber BDD — what BDD is, Gherkin keywords, project structure, hooks and tags, when Cucumber helps, common mistakes and tips for step reuse.

[N] pages [X] MB Oct 2026
Download PDF
PDF 02 Code Example

Feature File & Step Definitions Pack

A complete Gherkin feature file (login with Background, @smoke tag and Scenario Outline) plus the Java step definitions that wire each step to a page object.

[N] pages [X] MB Oct 2026
Download PDF
PDF 03 Reference

Gherkin Good vs Weak Wording Pack

Weak vs better step wording examples, guidance on writing declarative scenarios, plus Cucumber vs plain test frameworks comparison and step definition reuse tips.

[N] pages [X] MB Oct 2026
Download PDF

All three download buttons open the same Cucumber BDD guide PDF file. By downloading, you agree to our Privacy Policy. These PDFs are study material only — not a certificate or job guarantee.

00

What is Cucumber and BDD?

Behaviour-driven development, or BDD, is a way of working in which business people, developers and testers agree on examples of behaviour before building a feature, and write those examples in a shared, structured language. Cucumber is a tool that reads these examples, written in a language called Gherkin, and runs them against the application by calling automation code. The value is mostly in the conversation: the examples force the team to agree on what the feature should do. A side benefit is living documentation that stays accurate because it is executed. Cucumber is not a replacement for good test design, and for purely technical tests a plain framework is often simpler.

01

Gherkin keywords

Keyword Meaning
Feature Names the capability and describes its purpose
Background Steps shared by all scenarios in the file
Scenario One example of behaviour
Scenario Outline with Examples A template scenario run with several data rows
Given The starting context
When The action taken
Then The expected outcome
And, But Continue the previous step type
@tag Labels scenarios or features for filtering
02

A feature file

A readable specification in Gherkin. Business and technical people can both understand it.

@login
Feature: Login
  As a registered user
  I want to sign in
  So that I can see my dashboard

  Background:
    Given the user is on the login page

  @smoke
  Scenario: Successful login
    When the user enters email "test.user@example.com" and a valid password
    And clicks the login button
    Then the dashboard page is displayed

  Scenario Outline: Failed login messages
    When the user enters email "<email>" and password "<password>"
    And clicks the login button
    Then the error message "<message>" is displayed

    Examples:
      | email                  | password    | message               |
      | test.user@example.com  | wrong-pass  | Invalid credentials   |
      |                        |             | Email is required     |
03

Step definitions in Java

Each Gherkin step matches a method through an expression. Illustrative structure; the page object is assumed to exist.

import io.cucumber.java.en.*;
import org.junit.Assert;

public class LoginSteps {
    private final LoginPage loginPage = new LoginPage(Hooks.driver);

    @Given("the user is on the login page")
    public void userIsLoginPage() {
        loginPage.open();
    }

    @When("the user enters email {string} and password {string}")
    public void userEnterCredentials(String email, String password) {
        loginPage.enterEmail(email);
        loginPage.enterPassword(password);
    }

    @When("the user clicks the login button")
    public void clicksLogin() {
        loginPage.submit();
    }

    @Then("the error message {string} is displayed")
    public void errorIsDisplayed(String expected) {
        Assert.assertEquals(expected, loginPage.errorText());
    }
}
04

Project structure

Item Purpose
src/test/resources/features Feature files
steps package Step definition classes
pages package Page objects wrapping UI locators and actions
hooks class Before and After hooks for driver setup and teardown
runner class Configures which features, tags and reports run
config and utilities Environment settings, readers and helpers
05

Hooks and tags

  • → @Before and @After hooks run around each scenario, ideal for starting and closing the browser or capturing a screenshot on failure.
  • → Tags let you run subsets, such as smoke or regression, and attach hooks to specific scenarios.
  • → Background removes repeated Given steps, but keep it short.
06

Writing good Gherkin

Good scenarios describe behaviour from the user's point of view, not implementation. A step such as the user clicks the button with id submit-bttn ties the example to the interface and breaks whenever the design changes. A step such as the user submits the login form expresses intent and leaves the detail to the step definition. Keep scenarios short, with one clear outcome, and use concrete examples rather than abstract statements. Avoid long lists of steps that read like a manual script; if a scenario needs fifteen steps, it is probably testing too much.

07

Good and weak step wording

Weak Better
Given the user types abc in the field with id user Given a registered user has an account
When the user clicks the third button on the page When the user submits the login form
Then the div with class error appears Then the error message Invalid credentials is displayed
08

When Cucumber helps and when it does not

  • ✓ Helps when business stakeholders will actually read and contribute to the scenarios.
  • ✓ Helps to build shared understanding through example workshops.
  • ✗ Adds overhead when only testers read the files; plain code may then be simpler.
  • ✗ Needs discipline to avoid duplicated or overly detailed steps.
09

Common mistakes

What to avoid

  • UI-specific steps that make scenarios brittle.
  • Too many scenarios for trivial behaviour.
  • Imperative, long scripts instead of declarative examples.
  • Step definitions with logic that belongs in page objects.
  • Treating Cucumber as only a test tool and skipping the collaboration.
10

Cucumber versus plain test frameworks

Aspect Cucumber TestNG or JUnit alone
Readability for non-programmers High Low
Setup effort More: feature files plus step definitions Less
Collaboration value High if the business reviews scenarios Mostly for developers and testers
Maintenance risk Duplicate or vague steps if not managed Fewer layers to maintain
11

Tips for step definition reuse

  • → Write steps in business language so they can be reused across features.
  • → Use parameters such as {string} and {int} rather than hard-coded values.
  • → Keep step classes grouped by area, such as login or checkout.

Learn with a trainer

Ready to build Cucumber suites that business and engineering both trust? Explore Uncodemy's Software Testing course or book a free demo and learn from industry trainers.

View Course
About these PDFs: These PDFs are study material for learning and revision. They are not a certificate, a degree or a promise of a job, and technology changes, so check official documentation for the latest details. Spot an error? Write to info@uncodemy.com and the trainer team will review it.
FAQ

Frequently Asked Questions

What is Cucumber in testing?
Cucumber is a BDD tool that runs plain-language scenarios written in Gherkin by linking each step to automation code.
What is Gherkin?
Gherkin is the structured language used in Cucumber feature files, with keywords such as Feature, Scenario, Given, When and Then.
What is a step definition?
A step definition is a method in code that is matched to a Gherkin step and performs the corresponding action or check.
What is a Scenario Outline?
A Scenario Outline is a template scenario that runs several times with different data from an Examples table.
Is Cucumber better than TestNG?
They solve different problems. Cucumber focuses on readable, shared specifications, while TestNG is a general test framework. They can also be used together, with TestNG as the runner.
Are these PDFs free to download?
Yes. All Cucumber BDD guide PDFs on this page are free to download. No form is required — just click the download button on any card above. If a form is ever introduced, a consent checkbox and a link to our Privacy Policy will be added in line with the DPDP Act 2023.