Automated testing is crucial for long-term maintainability, but not all tests are made equal: a brittle test?tightly coupled to its implementation?can be worse than having no test at all!

If your test suite is more of a hindrance than a helper, you may be suffering from "Leadership said we have to write tests"-itis, a common ailment across the engineering community. Fortunately, this can be treated by taking the test suite you (might) already have and making it work *for* you instead of holding you back!

In this session, we'll analyze the characteristics of "good" and "bad" unit tests and how we can massage the latter into the former. Topics of discussion will include test organization, strict types, fixtures, test doubles, and the true value of code coverage as a metric. Examples use PHPUnit as the test runner, but the lessons are broadly applicable across test runners and languages. Some testing experience is encouraged, but not required.

Comments

Please login to leave a comment

This should be a first-day training for every new developer.

Also, how did you see my co-workers' pull requests?

Eric/a Seyden at 14:52 on 21 May 2026

Can I go back to work and give this exact presentation? I wish I had brought my whole team to this talk.

Andy Snell at 14:53 on 21 May 2026

Excellent intermediate testing talk. I especially liked the use of verbose guarding assertions to validate (and debug) test setup state.

```
#[DoesNotPerformAssertions]
public function testJustHappyToBeHere(): void
{
self::deprecating(true);
}

public function testThisTalkWasGood(): void
{
$talk = new ConferenceTalk('Steve', 'Getting the Most From Your Test Suite', '2026-05-21');
$this->assertSuccess($talk->outcome());
}
```

> vendor/bin/phpunit --no-coverage --no-extensions
PHPUnit 9.6.31 by Sebastian Bergmann and contributors.

Runtime: PHP 8.4.16
Configuration: /Users/phptek/talks/phpunit.xml.dist

...... 2 / 2 (100%)

Time: 45:01.008, Memory: 1 Grunwell

OK (2 tests, 1 assertion)