Testing for Lawful Good Adventures
summary
Shows concrete law testing: implements Monoid for Pair[Int] and Monad for a homegrown Option, wires up Arbitrary and Eq, then runs ScalaCheck-backed suites (ScalaZ uses ScalaCheck, cats uses discipline) and checks 100 random cases per law. Property testing generates biased inputs, finds failures and returns a minimized counterexample. Demonstrates what to implement (Arbitrary, Eq, typeclass instance), how tests are invoked (checkAll / discipline), and when an implementation actually fails.
AI-written summary · about
chapters (8)
- 0:00Start
- 2:46Overview
- 7:26Review of the Type Class Pattern
- 11:51Substitution Method
- 12:37Property Testing
- 13:41Test Case Minimization
- 14:01Generating Random Data
- 30:35Takeaways
related talks
01h 00mA New Approach to Testing with ScalaCheck / Property Based Testing
46mTesting in the world of Functional Programming
44mMonads for Testers
50mMonads for Testers
53mPractical ScalaCheck
51mWhen Types are Not Enough
48mPROBING THE UNPROVABLE AND PROVING THE IMPROBABLE
31mProperty-based testing - let your testing library work for you
