O'Reilly logo

Python Testing Cookbook by Greg L. Turnquist

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

Writing a testable novel with doctest

Running a series of story tests showcases your code's expected behavior. We have previously seen in the Writing a testable story with doctest recipe how to build a testable story and have it generate a useful report.

With this recipe, we will see how to use this tactic to string together multiple testable stories to form a testable novel.

Getting ready

For this recipe, we will be using the shopping cart application shown at the beginning of this chapter.

We will also re-use the BddDocTestRunner defined in this chapter's Writing a testable story with doctest recipe. But we will slightly alter it in the following steps.

How to do it...

With the following steps,we will look at how to write a testable novel:

  1. Create a ...

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