PHPUnit "No tests executed!" in CI
PHPUnit reports "No tests executed!" when it ran successfully but found nothing to run. The suite is misconfigured - wrong directory, a filter that matches nothing, or test files that do not meet PHPUnit’s discovery rules - rather than any test failing.
What this error means
PHPUnit exits (often 0 in older versions, non-zero in newer ones with failOnEmptyTestSuite) printing "No tests executed!". CI may pass falsely or fail, but no assertions ran.
PHPUnit 10.5.0 by Sebastian Bergmann and contributors.
No tests executed!Common causes
The testsuite directory is wrong or empty
phpunit.xml points at a directory that does not contain the tests (wrong path, wrong case on Linux), so discovery finds nothing.
A --filter or --group matches no tests
A filter, group, or path argument on the CI command excludes every test.
Test classes do not meet discovery rules
Files do not end in Test.php, classes do not extend TestCase, or methods are not marked as tests, so PHPUnit ignores them.
How to fix it
Point the testsuite at the real test directory
Fix the path (and case) in phpunit.xml so discovery finds the tests.
<!-- phpunit.xml -->
<testsuites>
<testsuite name="unit">
<directory>tests</directory>
</testsuite>
</testsuites>Check the CI filter and discovery rules
- Remove or correct any --filter/--group that excludes all tests.
- Ensure test files end in Test.php and classes extend PHPUnit\Framework\TestCase.
- Run phpunit --list-tests to confirm tests are discovered.
How to prevent it
- Add failOnEmptyTestSuite so an empty run fails loudly instead of passing.
- Keep phpunit.xml testsuite paths correct and case-accurate for Linux CI.
- Verify discovery locally with phpunit --list-tests before pushing.