Functional Tests as a Tree of Continuations (2010)
Published on: 2025-06-17 11:46:26
Functional Tests As A Tree Of Continuations
By Evan Miller
June 15, 2010
One of the most essential practices for maintaining the long-term quality of computer code is to write automated tests that ensure the program continues to act as expected, even when other people (including your future self) muck with it.
Test code is often longer than the code that is being tested. A former colleague estimates that the right ratio is around 3 lines of functional test code for every line of “real” code. Writing test code is often mindless and repetitive, because all you do is trace out all the steps a user could take and write down all the things that should be true about each one.
A great deal of test code simply exists to set up the tests. Sometimes you can abstract out the logic into setup() and teardown() functions, and put the fake data needed for tests into things called fixtures. Even then, you’ll often have a subset of tests that requires additional setup, and test code often becomes
... Read full article.