Testing Stateful and Concurrent Systems Using test.check
summary
Generative testing with test.check generators turns example tests into randomized sequences of operations that model a key‑value database, comparing its results to a hashmap model; the demo builds an ops generator, a runner for single‑threaded and threaded execution, and an interleaving enumerator for interleavings of concurrent ops. Shrinking finds tiny failing cases — shrinking to minimal counterexample — and adding a synthetic sleep op reproduces timing races; running each case multiple times reduces flaky heisenbugs.
AI-written summary · about
chapters (20)
- 0:00Intro
- 0:48Testing stateful, concurrent, and async systems using test.check
- 1:29Outline + Example-based testing is inadequate
- 2:29A stateful example
- 3:41store! should overwrite old values
- 5:58How big is our system?
- 7:18Let's set up some generators
- 8:35DB should contain a key/value after storing
- 12:17Build a simple, pure model • A key-value database is like a hash map
- 12:43Reify the operations and make generators
- 14:31Make 2 "runners"
- 16:07Define your property
- 22:45Run it in multiple threads
- 23:14Wait for them all to finish
- 24:01Start all threads at once
- 25:50Encourage collisions across threads
- 27:52Possible interleavings
- 28:36Repeatability (every?)
- 30:30Timing
- 31:31DB Runner
related talks
25mPowerful Testing with test.check
32mGenerative Testing: Properties, State and Beyond
33mLets Generate Tests
26mThe missing piece of testing
41mBuilding test check Generators
42mSurprise yourself with Property Based Testing
31mLincheck: Testing Concurrent Algorithms on JVM
37mBreaking the bank with test contract
