Skip to Main Content
Cucumber Recipes
book

Cucumber Recipes

by Ian Dees, Matt Wynne, Aslak Hellesoy
February 2013
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 45m
English
Pragmatic Bookshelf
Content preview from Cucumber Recipes
Recipe 39Test Python Code Using Lettuce

Problem

You want to test a Python app from Cucumber; for consistency’s sake, you want as much of your test code as possible to be in Python.

Ingredients

  • Lettuce for testing Python using a Cucumber-like syntax[259]

  • virtualenv for installing a Python sandbox to play in[260]

  • colorama for viewing pass/fail results in color on Windows[261]

Solution

There are a few different ways to drive Python code in plain English, each with its own set of trade-offs. Lettuce is a test framework that strikes a careful balance: it’s written in pure Python (so you won’t have to install extra dependencies to use it) but understands basic Gherkin syntax (so you can write similar tests to the ones you’d use in Cucumber). ...

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.
Start your free trial

You might also like

Cucumber Cookbook

Cucumber Cookbook

Shankar Garg
Basiswissen Softwaretest , 6th Edition

Basiswissen Softwaretest , 6th Edition

Andreas Spillner, Tilo Linz
React Cookbook

React Cookbook

David Griffiths, Dawn Griffiths

Publisher Resources

ISBN: 9781941222607Errata