Flaky Tests interview questions — Medium
249 medium-level Flaky Tests questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
Flaky Tests appears throughout Automation Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.
20 example questions
1. "Isolating unstable tests from the blocking pipeline" — in Flaky Tests, this describes which of the following?
- A. Quarantine.correct
- B. Order dependency.
- C. Wait-for condition.
- D. Hermetic environment.
Why: quarantine: Isolating unstable tests from the blocking pipeline.
2. "Fully isolated environment with no external shared dependencies" — in Flaky Tests, this describes which of the following?
- A. Hermetic environment.correct
- B. Test isolation.
- C. Flake rate.
- D. Wait-for condition.
Why: hermetic environment: Fully isolated environment with no external shared dependencies.
3. "Ensuring each test sets up and cleans its own state" — in Flaky Tests, this describes which of the following?
- A. Hermetic environment.
- B. Test isolation.correct
- C. Order dependency.
- D. Wait-for condition.
Why: test isolation: Ensuring each test sets up and cleans its own state.
4. "Percentage of runs where a test's outcome flips without code change" — in Flaky Tests, this describes which of the following?
- A. Quarantine.
- B. Flake rate.correct
- C. Test isolation.
- D. Deterministic test.
Why: flake rate: Percentage of runs where a test's outcome flips without code change.
5. "Test that produces the same result for the same code every run" — in Flaky Tests, this describes which of the following?
- A. Wait-for condition.
- B. Flake rate.
- C. Test isolation.
- D. Deterministic test.correct
Why: deterministic test: Test that produces the same result for the same code every run.
6. "Re-running failed tests a bounded number of times" — in Flaky Tests, this describes which of the following?
- A. Hermetic environment.
- B. Flake rate.
- C. Order dependency.
- D. Retry-on-failure.correct
Why: retry-on-failure: Re-running failed tests a bounded number of times.
7. "Failure mode where tests pass only in a specific sequence" — in Flaky Tests, this describes which of the following?
- A. Hermetic environment.
- B. Order dependency.correct
- C. Quarantine.
- D. Test isolation.
Why: order dependency: Failure mode where tests pass only in a specific sequence.
8. Which statement correctly describes Flaky Tests?
- A. Automatically retrying tests forever is a root-cause fix for flakiness.
- B. Measuring a flake rate per test over many runs identifies the worst offenders objectively.correct
- C. Flaky tests should be deleted immediately without investigation in all cases.
- D. Tests sharing global state never influence each other.
Why: Historical pass/fail data ranks tests for stabilization work.
9. Which of the following statements about Flaky Tests is TRUE?
- A. Shared mutable state between tests causes order-dependent failures.correct
- B. Automatically retrying tests forever is a root-cause fix for flakiness.
- C. Time-of-day can never affect the outcome of an automated test.
- D. Adding longer sleep() calls is the recommended permanent fix for flakiness.
Why: Tests must be independent to run in any order or in parallel.
10. Identify the accurate statement about Flaky Tests:
- A. Hard-coded sleeps are a leading cause of flakiness and should be replaced with condition-based waits.correct
- B. Adding longer sleep() calls is the recommended permanent fix for flakiness.
- C. Time-of-day can never affect the outcome of an automated test.
- D. Tests sharing global state never influence each other.
Why: Fixed sleeps are either too short (flaky) or too long (slow).
11. In Flaky Tests, which of the following is described as: "Fully isolated environment with no external shared dependencies"?
- A. Test isolation.
- B. Flake rate.
- C. Quarantine.
- D. Hermetic environment.correct
Why: hermetic environment: Fully isolated environment with no external shared dependencies.
12. In Flaky Tests, which of the following is described as: "Percentage of runs where a test's outcome flips without code change"?
- A. Quarantine.
- B. Flake rate.correct
- C. Hermetic environment.
- D. Test isolation.
Why: flake rate: Percentage of runs where a test's outcome flips without code change.
13. In Flaky Tests, which of the following is described as: "Failure mode where tests pass only in a specific sequence"?
- A. Wait-for condition.
- B. Flake rate.
- C. Order dependency.correct
- D. Hermetic environment.
Why: order dependency: Failure mode where tests pass only in a specific sequence.
14. Which Flaky Tests concept matches this description: "Failure mode where tests pass only in a specific sequence"?
- A. Hermetic environment.
- B. Order dependency.correct
- C. Wait-for condition.
- D. Quarantine.
Why: order dependency: Failure mode where tests pass only in a specific sequence.
15. In the context of Flaky Tests, which of the following is a correct statement?
- A. Measuring a flake rate per test over many runs identifies the worst offenders objectively.correct
- B. Adding longer sleep() calls is the recommended permanent fix for flakiness.
- C. Tests sharing global state never influence each other.
- D. Time-of-day can never affect the outcome of an automated test.
Why: Historical pass/fail data ranks tests for stabilization work.
16. Which Flaky Tests concept matches this description: "Re-running failed tests a bounded number of times"?
- A. Test isolation.
- B. Wait-for condition.
- C. Deterministic test.
- D. Retry-on-failure.correct
Why: retry-on-failure: Re-running failed tests a bounded number of times.
17. Which Flaky Tests concept matches this description: "Percentage of runs where a test's outcome flips without code change"?
- A. Deterministic test.
- B. Order dependency.
- C. Quarantine.
- D. Flake rate.correct
Why: flake rate: Percentage of runs where a test's outcome flips without code change.
18. In Flaky Tests, which of the following is described as: "Ensuring each test sets up and cleans its own state"?
- A. Flake rate.
- B. Test isolation.correct
- C. Hermetic environment.
- D. Wait-for condition.
Why: test isolation: Ensuring each test sets up and cleans its own state.
19. Which Flaky Tests concept matches this description: "Isolating unstable tests from the blocking pipeline"?
- A. Deterministic test.
- B. Wait-for condition.
- C. Order dependency.
- D. Quarantine.correct
Why: quarantine: Isolating unstable tests from the blocking pipeline.
20. Which Flaky Tests concept matches this description: "Polling until an application state is true instead of sleeping"?
- A. Hermetic environment.
- B. Test isolation.
- C. Quarantine.
- D. Wait-for condition.correct
Why: wait-for condition: Polling until an application state is true instead of sleeping.