Recipe 12Test Through Multiple Interfaces Using Worlds

Problem

Your application has multiple public-facing interfaces, such as a graphical user interface (GUI) and an application programming interface (API). You’d like to test your code through both interfaces using the same set of Cucumber features.

Ingredients

  • Multiple implementations of the World,[81] an object that Cucumber creates and passes into each test

  • Selenium WebDriver[82] for testing a web app through the browser

  • HTTParty[83] for testing an HTTP API

  • The Sinatra web framework[84] to implement the example app

Solution

Many applications support more than one interface for controlling the underlying business logic. Your app might have a desktop GUI, a web interface, a REST API, some custom ...

Get Cucumber Recipes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.