Don’t write flaky tests.

Stop chasing your tail with unreliable tests.

Tests that fail randomly are more trouble than they are worth. A suite might pass for you but then fail for someone else, giving you a harsh code review. Or worse, a failing test might pass long enough to get into production.

Tests should always pass or fail given one version of the code. There should never be tests that “sometimes” fail. You certainly wouldn’t accept a flaky specification, so demand that all tests are deterministic.

You need to be able to rely on the test suite with complete confidence. Otherwise, everything is going to slow down dramatically and your development costs will increase as well. Furthermore, without a reliable test suite, you’ll have to hire a department of quality assurance testers which will also slow things down and increase costs.

Hold the line. Refuse to accept flaky tests.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: