Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Phpunit Slow Test Detector

Phpunit Slow Test Detector Laravel Package

ergebnis/phpunit-slow-test-detector

Detect slow PHPUnit tests with an extension delivered as a Composer package or PHAR. Configure a global maximum duration and get a report of tests exceeding the threshold after each run—ideal for catching performance regressions in your suite.

View on GitHub
Deep Wiki
Context7

ergebnis/phpunit-slow-test-detector is a PHPUnit extension that detects and reports slow tests during your test runs. Available as a Composer package or Phar, it helps you spot performance regressions by highlighting tests that exceed a configured maximum duration.

Integrate it into your PHPUnit setup and get a clear, ordered summary of slow tests right in the console output.

  • Reports tests exceeding a global max duration
  • Outputs a ranked list with per-test execution time
  • Works with phpunit/phpunit runs for quick feedback
  • Installable via Composer or as a Phar archive
  • Designed for easy configuration and bootstrapping
Frequently asked questions about Phpunit Slow Test Detector
How do I install this package for Laravel projects?
Run `composer require --dev ergebnis/phpunit-slow-test-detector` in your Laravel project. It integrates seamlessly with Laravel’s default PHPUnit setup and requires no additional Laravel-specific configuration.
Will this work with Laravel’s built-in PHPUnit configuration?
Yes, it works out-of-the-box with Laravel’s default `phpunit.xml` configuration. No changes to Laravel’s test setup are needed beyond installing the package and configuring the slow-test threshold.
What Laravel versions and PHPUnit setups does this support?
This package supports PHPUnit 6.5–13.x, which covers most Laravel projects. Laravel 10+ (PHP 8.1+) and earlier versions (PHP 7.4+) are supported as long as your PHPUnit version is within the supported range.
How do I configure the maximum duration for slow tests?
Add `<phpunit>` configuration to your `phpunit.xml` file: `<phpunit ...><phpunit-slow-test-detector maximum-duration="1000" />...</phpunit>`. The value is in milliseconds (e.g., `1000` = 1 second).
Can I use this in CI/CD pipelines for Laravel?
Absolutely. Add it to your CI workflow (e.g., GitHub Actions) alongside `php artisan test`. The console output will highlight slow tests, and you can extend it with custom scripts to fail builds or notify teams.
Does this work with PestPHP or other testing frameworks?
No, this package is designed for PHPUnit only. If you use PestPHP, it already includes built-in test timing metrics, so this package isn’t needed.
How do I interpret the ranked list of slow tests?
The output lists tests sorted by duration (slowest first) with their execution time in milliseconds. Focus on the top entries to identify performance bottlenecks in your Laravel test suite.
Will this slow down my Laravel test suite?
No, the package adds negligible overhead. It only runs after tests complete and doesn’t interfere with test execution speed. It’s purely a reporting tool.
Can I export slow test data for monitoring or alerts?
Currently, output is console-based only. For advanced use cases, you’d need to parse the console output or integrate it with custom scripts to send alerts (e.g., Slack) or log data to a database.
What if my Laravel tests have varying performance needs (e.g., unit vs. integration tests)?
Use separate `phpunit.xml` configurations for different test suites and set different `maximum-duration` values. For example, enforce stricter thresholds for unit tests and lenient ones for integration tests.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport