A flaky test is a test that passes sometimes and fails sometimes, even though no code has changed. The causes are race conditions, leaked state, network/third-party dependency, randomness and fixed time dependency. The solution to this sort of race condition is easy: just remove the asynchronicity.
Table of contents
What is a flaky test?Race conditionsLeaked stateNetwork/third-party dependencyRandomnessFixed time dependencyTakeawaysSort: