O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4Step Definitions: From the Outside

Now that you know how to use Gherkin to describe what you want your tests to do, the next task is to tell them how to do it. Whether you choose to drive your acceptance tests from Cucumber scenarios or simple Test::Unit scripts, there’s no escaping the fact that you’re going to need to write some code eventually. It’s about that time.

Step definitions sit right on the boundary between the business’s domain and the programmer’s domain. They’re written in Ruby,[9] and their responsibility is to translate each plain-language step in your Gherkin scenarios into concrete actions in Ruby code. As an example, take this step from the ATM scenario in the previous chapter:

 Given I have $100 in my Account ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required