Every week in my Tuesday Lunch & Learn livestream, we choose a useful software development skill, define a challenge related to that skill, and solve the challenge live. This week, we’re preventing flaky clock tests.
There’s nothing more frustrating than flaky tests: tests that fail randomly. You end up having to run your test suite over and over to get a good result, even if there’s nothing wrong with your actual code. And code that involves time—that interacts with the system clock—are one of the most common cause of flaky tests.
In today’s episode, we kill flaky clock tests dead. If you use these techniques, you’ll never have another flaky clock test.
Visit the Lunch & Learn archive for more.