Skip to Content
Test-Driven Development with Python, 2nd Edition
book

Test-Driven Development with Python, 2nd Edition

by Harry Percival
August 2017
Intermediate to advanced
624 pages
12h 18m
English
O'Reilly Media, Inc.
Content preview from Test-Driven Development with Python, 2nd Edition

Appendix H. Cheat Sheet

By popular demand, this “cheat sheet” is loosely based on the little recap/summary boxes from the end of each chapter. The idea is to provide a few reminders, and links to the chapters where you can find out more to jog your memory. I hope you find it useful!

Initial Project Setup

  • Start with a User Story and map it to a first functional test.

  • Pick a test framework—unittest is fine, and options like py.test, nose, or Green can also offer some advantages.

  • Run the functional test and see your first expected failure.

  • Pick a web framework such as Django, and find out how to run unit tests against it.

  • Create your first unit test to address the current FT failure, and see it fail.

  • Do your first commit to a VCS like Git.

Relevant chapters: Chapter 1, Chapter 2, Chapter 3

The Basic TDD Workflow

  • Double-loop TDD (Figure H-1)

  • Red, Green, Refactor

  • Triangulation

  • The scratchpad

  • “3 Strikes and Refactor”

  • “Working State to Working State”

  • “YAGNI”

A flowchart showing functional tests as the overall cycle, and unit tests helping to code
Figure H-1. The TDD process with functional and unit tests

Relevant chapters: Chapter 4, Chapter 5, Chapter 7

Moving Beyond Dev-Only Testing

  • Start system testing early. Ensure your components work together: web server, static content, database.

  • Build a staging environment to match your production environment, and run your FT suite against it.

  • Automate your staging and production environments: ...

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

Test-Driven Development with Python, 3rd Edition

Test-Driven Development with Python, 3rd Edition

Harry Percival

Publisher Resources

ISBN: 9781491958698Errata Page