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

In-Process Testing of Rack-Based REST APIs

Let’s start with the first approach, where both Cucumber and your application run in the same Ruby process. We’ll be dealing with a simple REST API for storing and retrieving fruit. It’s probably not the most useful system in the world but should allow us to illustrate the fundamentals of REST and Cucumber.

We’re going to build our web service from scratch. Create a new project with a features directory in it, and create this file:

 Feature​: Fruit list
  In order to make a great smoothie
  I need some fruit.
 
 Scenario​: List fruit
 Given the system knows about the following fruit​:
  | name | color |
  | banana | yellow |
  | strawberry | red ...

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