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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.