Testing Asynchronous OTP
summary
Practical techniques for testing async BEAM code: treat stateful processes as black boxes or split into a pure functional core plus a thin GenServer wrapper; start test children with start_supervised so they shut down cleanly; observe background work by sending notifications and using assert_receive or replace external calls with mocks/test doubles; make periodic actions triggerable or run in manual mode; only test crash behavior when cleanup must happen; consider the subs tool for property‑style failure simulation of supervision trees.
AI-written summary · about
chapters (42)
- 0:00Intro
- 1:00Community
- 1:18Community Careers
- 1:31Testing a Lecture
- 2:36What is Hard
- 3:29Global Resources
- 4:09System Failures
- 5:51Lessons
- 7:26Ideas not recipes
- 8:28Acceptance
- 9:07Outline
- 9:42Stateful Processes
- 10:05Rolling Average Server
- 11:08Data Structure
- 12:15Testing Changes in State
- 12:32Unit Testing
- 16:08Data Structures
- 17:45sysgets
- 17:55rollingaverage
- 19:42OTP behaviors
- 20:45Supervisor
- 21:26Supervisor semantics
- 23:03Testing background code
- 23:29Example
- 23:44How do I know when it is done
- 23:58Message Passing
- 25:26Search Receive
- 27:02Mock Example
- 28:22Periodic Actions
- 28:41Weather Check
- 30:38Obstruction
- 33:31Singleton
- 35:44Resilience
- 36:07Unexpected failures
- 37:24Disk memory leak
- 39:00Supervision trees
- 39:30Manual testing
- 40:03Subs
- 40:56Testing is hard
- 41:28Why do we test
- 42:59The dirty test
- 43:30Testing is not automated
related talks
31mThe ABCs of OTP
43mUnlocking the Potential of OTP: Proven Strategies for Application Dev
30mHow to Test Asynchronous Code
20mUsing OTP in Your Phoenix App
23mElixir GenServer: Understanding Elixir concurrency model
36mTesting Stateful and Concurrent Systems Using test.check
37mRethinking How We Test Our Async Architecture
36mStateful property-based testing: with a game logic case study
