What We Just Learned
It’s useful to think of a step definition as being a special kind of method. Unlike a regular method, whose name has to match exactly, a step definition can be invoked by any step that matches its regular expression. Because regular expressions can contain wildcards, this means you have the flexibility to make the Gherkin steps nice and readable, while keeping your Java step definition code clean and free of duplication.
-
Step definitions provide a mapping from the Gherkin scenarios’ plain-language descriptions of user actions into Java code, which simulates those actions.
-
Step definitions are registered with Cucumber by using @Given, @When, @Then, or one of the aliases for your spoken language.
-
Step definitions use ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access