Breaking the bank with test contract
summary
Claim: test.contract (Clojure) gives fast, deterministic generative tests that replace slow integration setups by modeling stateful protocols. Uses test.check QuickCheck-style generators, pure-state models, shrinking (an example failing sequence shrinks from ~50 calls to 2), and three primitives: verify (model vs real), mock (pure in-memory substitute), and test proxy (dual-call shadowing). Applied at a 150,000-line bank codebase with ~150 tests, it removes test containers and flaky network deps and proves the mock matches production behavior.
AI-written summary · about
chapters (26)
- 0:00Introduction
- 1:32Side effects and nondeterminism
- 3:17Why test
- 4:08Quick Check
- 9:05Traditional advice
- 10:28The missing axis
- 11:23Determinist simulation testing
- 15:23Lessons learned
- 15:59Why we killed our N test suite
- 16:20My Approach
- 16:35Application
- 17:45Closure protocol
- 18:36Closure model
- 20:39Verify model
- 21:37Mocks
- 24:49Injection errors
- 25:20Shrinking
- 27:03Recap
- 27:38Limitations
- 29:23Lessons
- 29:33Define the correctness
- 31:02Weve used test contract
- 31:55What do we need
- 33:15Consistency model
- 33:29Consistency chart
- 36:22Summary
related talks
31mTesting Made Simple
32mGenerative Testing: Properties, State and Beyond
25mPowerful Testing with test.check
33mPractical Contract Testing with Spring Cloud Contract
20mUnlock The Power Of Property-Based Testing
36mTesting Stateful and Concurrent Systems Using test.check
44mGenerative Integration Tests
33mLets Generate Tests
