← Graph

Logic in Tests

concept 2 connections

Anti-pattern covered in Rodzik's talk. Tests that contain conditionals (`if p1_score > p2_score then expect ping else expect miri`), loops iterating over 100 products, or calls to production helpers like `cents_to_dollars` are harder to read and often fail to actually test anything: the test's logic mirrors the production logic, so a bug in one passes the other. Symptom: when a loop-driven test fails on 'product 101', the failure message doesn't tell you which product. Rule of thumb: tests should be immediately understandable and should not duplicate production logic.

category
practice
about
Logic in Tests concept
First iteration of tests uses conditionals that mirror production logic, demonstrating the anti-pattern.
about
Logic in Tests concept
Recommendation targets this anti-pattern.

Provenance

Read by
7 extractions