Hasty Briefsbeta

Bilingual

Why Property Testing Finds Bugs Unit Testing Does Not (2021)

a year ago
  • #Property-Based Testing
  • #Software Development
  • #Unit Testing
  • Property-Based Testing (PBT) involves testing general properties of a function with randomized inputs rather than specific input-output pairs.
  • PBT is powerful for testing a wide range of inputs but requires learning how to define properties and generate complex input strategies.
  • Brian Marick argues that most errors found in testing are either partition errors or boundary errors, which can be addressed with manual unit tests.
  • PBT's advantage over manual unit testing lies in handling the combinatorial explosion of boundary conditions and edge cases in complex problems.
  • The complexity of input spaces increases with the number of variables, making it harder to manually identify all edge cases.
  • Common PBT examples, like testing addition commutativity or list reversal, are too simplistic and don't showcase PBT's real benefits.
  • Effective PBT examples should involve complex input spaces (e.g., strings, dictionaries) where manual testing might miss edge cases.
  • Writing good PBT strategies is library-specific, making it harder to generalize skills across different PBT tools.