Slow test suites are a productivity killer, burning developer time and eroding trust in the codebase. The root cause is almost always test design, not tooling. Four tiers of fixes are outlined in priority order: configuration wins (disabling global process isolation, moving coverage to CI), test design improvements (proper unit test isolation, in-memory databases, lazy fixtures, data providers), parallelisation (with ParaTest, using transactional rollback or template databases for isolation), and infrastructure optimizations (RAM disks, Docker layer caching, CI sharding). The key insight is that test design beats infrastructure every time — parallelising a poorly designed suite just gives you slowness in parallel. Measurement using PHPUnit's Open Test Reporting format should always precede optimization, since intuition about which tests are slow is frequently wrong.

7m read timeFrom phpunit.expert
Post cover image
Table of contents
The real cost of slow testsWhy tests get slowMeasure before you optimiseFour tiers of fixesSome tests should be slowThree things to take away
400 Impressions