Take your slow tests to the doctor
summary
A toolkit called despereaux diagnoses slow specs and ships recipes like factory_doctor and create_all to cut wasted DB work; projects see test suites drop by about 4x after finding hot spots. Specific fixes include lowering bcrypt cost to halve auth-test time, disabling inline Sidekiq for ~20% savings, and replacing many persistent factory calls (which consumed ~80% of time) to obtain ~3x speedups. The talk demonstrates exact profiling techniques and refactoring steps used.
AI-written summary · about
chapters (16)
- 0:00Introduction and speaker intro
- 2:17Why slow tests matter
- 6:44Introducing Despereaux toolset
- 8:25Profiling tools for tests
- 12:42Sampling profiler and optimizations
- 15:15Integration with testing frameworks
- 20:24Special providers and psychic jobs
- 21:10Factories vs fixtures
- 23:42Factory bottlenecks
- 28:50Creative old and fixture reuse
- 30:42Database cleanup and fixtures
- 31:48Fixture efficiency gains
- 33:07Before callbacks and setup
- 35:42Combining expectations in specs
- 36:30Why developers care about tests
- 37:35Future ideas and conclusion
related talks
02h 05mFrom slow to go: Rails test profiling hands-on
02h 05mFrom slow to go: Rails test profiling hands-on
29mYour test suite is making too many database calls!
09mSpeeding Up Your Test Suite
29m"Testing. Why so serious?"
24mSupercharging CI: Test Suite Optimization for Speed, Stability, and Savings
41mHigh Cost Tests and High Value Tests
58mSpeed up your test suite by throwing computers at it
