Dealing with Flaky Tests
Dealing with Flaky Tests
For the past day or so, I have had my head down, tearing my hair out, trying to debug a significant block caused by many engineers’ arch nemesis: a flaky test.
In my case, it’s actually been several flaky tests.
A flaky test is any test for your code that only sometimes fails.
It shows up when a part of your test relies on something non-deterministic.
Non-deterministic components can include:
Fetching resources over a network connection.
Reading from a random number generator.
Using a non-deterministic asynchronous scheduler.
Animations (often use the GPU ).
…and many more.
If your application includes code that looks anything like these, you are at risk for flaky tests.
My use-case happened to be especially v…