Skip to content

Commit 7ef23a3

Browse files
authored
Revise the flaky tests section (#12)
1 parent 66ab13e commit 7ef23a3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

recipes/automated-testing.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ Write tests to cover those paths in a way that gives confidence that each path,
1515

1616
---
1717

18-
Deal with flaky tests immediately. Flaky tests ruin test suite confidence. A failed
19-
test should raise alarm immediately. If the test suite contains flaky tests, disable
20-
them and refactor as soon as possible.
18+
Flaky tests that produce inconsistent results ruin confidence in the test suite, mask real issues, and are the source of frustration. The refactoring process to address the flakiness is crucial and should be a priority.
19+
To adequately deal with flaky tests it is important to know how to identify, fix, and prevent them:
20+
- Common characteristics of flaky tests include inconsistency, false positives and negatives, and sensitivity to dependency, timing, ordering, and environment.
21+
- Typical causes of the stated characteristics are concurrency, timing/ordering problems, external dependencies, non-deterministic assertions, test environment instability, and poorly written test logic.
22+
- Detecting flaky tests can be achieved by rerunning, running tests in parallel, executing in different environments, and analyzing test results.
23+
- To fix and prevent further occurrences of flaky tests the following steps can be taken, isolate tests, employ setup and cleanup routines, handle concurrency, configure a stable test environment, improve error handling, simplify testing logic, and proactively deal with typical causes of the flaky tests.
2124

2225
---
2326

0 commit comments

Comments
 (0)