Step definitions are the code (methods) that implement Gherkin steps. Each is annotated with @Given/@When/@Then and a pattern that matches the step text; this mapping layer is called the 'glue'.
When Cucumber reads a step like 'When the user enters valid credentials', it finds the step-definition method whose pattern matches that text and runs it. In Java: @When("the user enters valid credentials") public void enterCreds() { loginPage.login(user, pass); }. Parameters in the step (numbers, quoted strings) are captured and passed as method arguments. The 'glue' path tells Cucumber where the step-definition classes live. One step definition can serve many scenarios, so reusable, parameterized steps reduce duplication. A missing/ambiguous match causes an undefined or ambiguous step error.
@Then("the order total should be {double}") public void checkTotal(double expected) { assertEquals(expected, cart.total()); } — one parameterized step verifies any expected total across many scenarios.
A scenario fails with 'Undefined step'. What does it mean and how do you fix it?