Writing a testable story with Lettuce

Lettuce (http://lettuce.it) is a Cucumber-like BDD tool built for Python.

Cucumber (http://cukes.info) was developed by the Ruby community and provides a way to write scenarios in a textual style. By letting our stakeholders read the stories, they can easily discern what the software is expected to do.

This recipe shows how to install Lettuce, write a test story, and then wire it into our shopping cart application to exercise our code.

Getting ready

For this recipe, we will be using the shopping cart application shown at the beginning of this chapter. We also need to install Lettuce and its dependencies.

Install lettuce by typing pip install lettuce.

How to do it...

In the following steps, we will explore creating ...

Get Python Testing Cookbook now with O’Reilly online learning.

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