All lessons in Software Engineering: Programs, Systems, and Maintainable Software

Property Tests and Mutation Analysis

Derive properties from contracts and interpret surviving mutations without chasing a score.

40 minutes · Members lesson · preview

What you will learn

  • Derive a property from a behavioral contract rather than copying implementation logic.
  • Use generated small inputs and shrinking to find a minimal counterexample.
  • Interpret a surviving mutation as an investigation result rather than an automatic verdict.

Your lower-bound tests cover three hand-written lists. They pass, but a duplicate-heavy list still returns the second matching element. Property tests can explore more combinations while checking an invariant of the answer. Mutation analysis asks a complementary question: would the tests notice a deliberate change in behavior?

Both techniques improve the questions you ask of a test suite. Neither turns a passing result into a proof of all program behavior.

Choose another lesson