Score Flaky Tests From CI History Using Same-Commit Outcome Flips

Last updated: November 29, 2026

Quick Overview

Given a log of test runs with test name, commit, and pass or fail, identify flaky tests (tests that both pass and fail on the same code) and rank them by how often their outcome flips across reruns, without confusing genuine regressions for flakiness.

Google
Software Engineering Fundamentals
Software Engineer
Google
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Medium

0

0

0 solved


Given a log of test runs with test name, commit, and pass or fail, identify flaky tests (tests that both pass and fail on the same code) and rank them by how often their outcome flips across reruns, without confusing genuine regressions for flakiness.

Google's monorepo CI reruns failing tests and has studied flakiness extensively because it erodes trust in presubmit signals. This screen checks whether the candidate defines flakiness carefully (same commit, different outcomes), separates it from real breakages, and builds a ranking that a team could act on.

What the Interviewer Expects
  • Defines flakiness as differing outcomes on the same commit, not across commits
  • Groups runs by test and commit before scoring
  • Normalizes by rerun count so heavily run tests are not unfairly ranked
  • Applies a minimum sample size to avoid noisy conclusions
  • Explains how the report feeds quarantine or ownership workflows
Key Topics to Cover
flaky tests
continuous integration
grouping and aggregation
test reliability
ranking
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you factor in environment differences such as machine type or shard?
  • How would you tell a test that became flaky at a specific commit?
  • How do you decide when to quarantine versus fix?
  • How would you compute this incrementally over billions of runs?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Input: list of (test, commit, passed) in execution order.
  • Output: flaky tests with a score in [0, 1] and how many commits showed flakiness, highest score first.
  • A test that fails consistentl...
High-Level Design

Group outcomes by test then by commit. On a single commit the code is fixed, so any change in outcome between reruns is nondeterminism. Count adjacent flips within each commit and divide by the number...


Submit Your Answer
Markdown supported