Exercise 3: An Untouched Tier's Scenario — Possible Solution ==================================================================== THE SCENARIO ------------------------------ def scenario_basic_member_gets_no_discount(apply_discount_fn): # GIVEN a cart total of $100 cart_total = 100 # AND a member with no recognized tier membership_tier = "BASIC" # WHEN the discount is applied result = apply_discount_fn(cart_total, membership_tier) # THEN the total is unchanged assert result == 100 RESULTS ------------------------------ Against original apply_discount: PASS Against changed apply_discount_v2 (GOLD moved to 15%): PASS Both versions pass this scenario unchanged. WHY THIS ONE IS UNAFFECTED ------------------------------ apply_discount's own fallback branch (the implicit "no matching tier" case, which just returns cart_total unchanged) was never touched by the GOLD-tier policy change - only the GOLD branch's own multiplier moved from 0.9 to 0.85. A BDD scenario only fails when the SPECIFIC behavior it describes actually changes; it says nothing about parts of the system it doesn't exercise. This scenario, by construction, never exercises the GOLD branch at all, so it has no way to notice - or care - that GOLD's own discount changed. WHY THIS WORKS AS AN ANSWER ------------------------------ This is an important, honest boundary on the chapter's own claim: BDD scenarios don't provide blanket protection against every possible change to a system - each scenario only ever verifies the specific slice of behavior it was written to describe. A full, trustworthy living specification needs one scenario per meaningful behavior (as this chapter's own three tiers each got their own), not one scenario standing in for the whole system. This mirrors Chapter 2's own fault-localization theme: a scenario that only touches BASIC-tier behavior can only ever tell you about BASIC-tier behavior, precisely localized, and nothing about GOLD or PLATINUM.