Measure Test Suite Strength With a Small Mutation Testing Tool

Last updated: November 29, 2026

Quick Overview

Line coverage says a function is fully covered, yet bugs keep slipping through. Build a tiny mutation tester that flips comparison and arithmetic operators one at a time, runs the tests against each mutant, and reports which mutants survive, then use it to strengthen a weak test.

Google
Software Engineering Fundamentals
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Hard

0

0

0 solved


Line coverage says a function is fully covered, yet bugs keep slipping through. Build a tiny mutation tester that flips comparison and arithmetic operators one at a time, runs the tests against each mutant, and reports which mutants survive, then use it to strengthen a weak test.

Google has published work on running mutation testing at scale inside code review, surfacing surviving mutants as reviewer hints. An onsite interviewer might use this to probe whether a candidate understands the gap between coverage and fault detection and can manipulate an AST safely.

What the Interviewer Expects
  • Explains why 100 percent coverage does not imply strong assertions
  • Applies exactly one mutation per mutant via an AST transform
  • Counts killed versus surviving mutants and reports where survivors are
  • Treats exceptions in mutants as kills
  • Uses survivors to write targeted boundary tests
  • Discusses equivalent mutants and runtime cost
Key Topics to Cover
mutation testing
code coverage
abstract syntax tree
test adequacy
boundary testing
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 do you handle equivalent mutants that can never be killed?
  • How would you keep the cost manageable on a large codebase?
  • Which mutation operators give the most signal per run?
  • How would you show results to a code reviewer without noise?
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: source of a function, its name, and a test callable that returns True when tests pass.
  • Generate one mutant per mutable site: swap </<=, >/>=, ==/!=, +/-.
  • Output: killed co...
High-Level Design

Parse the source once per mutant with ast, and walk it with a NodeTransformer that counts mutable sites and changes only the site whose index equals the target. Compile and exec the mutated tree i...


Submit Your Answer
Markdown supported