Chapter 27. Fast Tests, Slow Tests, and Hot Lava
The database is hot lava!
Casey Kinsey
We’ve come to the end of the book, and the end of our journey with this to-do app and its tests. Let’s recap our test structure so far:
-
We have a suite of functional tests that use Selenium to test that the whole app really works. On several occasions, the FTs have saved us from shipping broken code—whether it was broken CSS, a broken database due to filesystem permissions, or broken email integration.
-
And we have a suite of unit tests that use Django test client, enabling us to test-drive our code for models, forms, views, URLs, and even (to some extent) templates. They’ve enabled us to build the app incrementally, to refactor with confidence, and they’ve supported a fast unit-test/code cycle.
-
We’ve also spent a good bit of time on our infrastructure, packaging up our app with Docker for ease of deployment, and we’ve set up a CI pipeline to run our tests automatically on push.
However, being a simple app that could fit in a book, there are inevitably some limitations and simplifications in our approach. In this chapter, I’d like to talk about how to carry your testing principles forward, as you move into larger, more complex applications in the real world.
Let’s find out why someone might say that the database is hot lava!
Why Do We Test? Our Desiderata for Effective Tests
At testdesiderata.com, Kent Beck and Kelly Sutton outline several desiderata (desirable characteristics) for ...
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.
Read now
Unlock full access