{"id":15014456,"url":"https://github.com/ergebnis/phpunit-slow-test-detector","last_synced_at":"2026-02-07T16:07:55.945Z","repository":{"id":38358559,"uuid":"332171149","full_name":"ergebnis/phpunit-slow-test-detector","owner":"ergebnis","description":"⏱️ Provides a composer package with an extension for detecting slow tests in phpunit/phpunit.","archived":false,"fork":false,"pushed_at":"2024-10-25T11:56:52.000Z","size":10210,"stargazers_count":121,"open_issues_count":9,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-29T17:33:44.767Z","etag":null,"topics":["detector","extension","phpunit","slow","test"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ergebnis.png","metadata":{"funding":{"github":["ergebnis","localheinz"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-23T09:19:21.000Z","updated_at":"2024-10-29T06:57:40.000Z","dependencies_parsed_at":"2024-05-02T14:09:55.036Z","dependency_job_id":"94a34c99-bcc9-4294-b149-89a70084b825","html_url":"https://github.com/ergebnis/phpunit-slow-test-detector","commit_stats":{"total_commits":791,"total_committers":6,"mean_commits":"131.83333333333334","dds":0.4260429835651075,"last_synced_commit":"ba37a5b486e42a5a6d0a48a95e5ab8725870ca18"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":"ergebnis/php-package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fphpunit-slow-test-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fphpunit-slow-test-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fphpunit-slow-test-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergebnis%2Fphpunit-slow-test-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ergebnis","download_url":"https://codeload.github.com/ergebnis/phpunit-slow-test-detector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247737770,"owners_count":20987718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detector","extension","phpunit","slow","test"],"created_at":"2024-09-24T19:45:39.463Z","updated_at":"2026-02-07T16:07:55.938Z","avatar_url":"https://github.com/ergebnis.png","language":"PHP","readme":"# phpunit-slow-test-detector\n\n[![Integrate](https://github.com/ergebnis/phpunit-slow-test-detector/workflows/Integrate/badge.svg)](https://github.com/ergebnis/phpunit-slow-test-detector/actions)\n[![Merge](https://github.com/ergebnis/phpunit-slow-test-detector/workflows/Merge/badge.svg)](https://github.com/ergebnis/phpunit-slow-test-detector/actions)\n[![Release](https://github.com/ergebnis/phpunit-slow-test-detector/workflows/Release/badge.svg)](https://github.com/ergebnis/phpunit-slow-test-detector/actions)\n[![Renew](https://github.com/ergebnis/phpunit-slow-test-detector/workflows/Renew/badge.svg)](https://github.com/ergebnis/phpunit-slow-test-detector/actions)\n\n[![Code Coverage](https://codecov.io/gh/ergebnis/phpunit-slow-test-detector/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/phpunit-slow-test-detector)\n\n[![Latest Stable Version](https://poser.pugx.org/ergebnis/phpunit-slow-test-detector/v/stable)](https://packagist.org/packages/ergebnis/phpunit-slow-test-detector)\n[![Total Downloads](https://poser.pugx.org/ergebnis/phpunit-slow-test-detector/downloads)](https://packagist.org/packages/ergebnis/phpunit-slow-test-detector)\n[![Monthly Downloads](http://poser.pugx.org/ergebnis/phpunit-slow-test-detector/d/monthly)](https://packagist.org/packages/ergebnis/phpunit-slow-test-detector)\n\nThis project provides a [`composer`](https://getcomposer.org) package and a [Phar archive](https://www.php.net/manual/en/book.phar.php) with an extension for detecting slow tests in [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit).\n\nThe extension is compatible with the following versions of `phpunit/phpunit`:\n\n- [`phpunit/phpunit:^12.0.0`](https://github.com/sebastianbergmann/phpunit/tree/12.0.0)\n- [`phpunit/phpunit:^11.0.0`](https://github.com/sebastianbergmann/phpunit/tree/11.0.0)\n- [`phpunit/phpunit:^10.0.0`](https://github.com/sebastianbergmann/phpunit/tree/10.0.0)\n- [`phpunit/phpunit:^9.0.0`](https://github.com/sebastianbergmann/phpunit/tree/9.0.0)\n- [`phpunit/phpunit:^8.5.19`](https://github.com/sebastianbergmann/phpunit/tree/8.5.19)\n- [`phpunit/phpunit:^7.5.0`](https://github.com/sebastianbergmann/phpunit/tree/7.5.0)\n- [`phpunit/phpunit:^6.5.0`](https://github.com/sebastianbergmann/phpunit/tree/6.5.0)\n\n## Installation\n\n### Installation with `composer`\n\nRun\n\n```sh\ncomposer require --dev ergebnis/phpunit-slow-test-detector\n```\n\nto install `ergebnis/phpunit-slow-test-detector` as a `composer` package.\n\n### Installation as Phar\n\nDownload `phpunit-slow-test-detector.phar` from the [latest release](https://github.com/ergebnis/phpunit-slow-test-detector/releases/latest).\n\n## Usage\n\n### Bootstrapping the extension\n\nBefore the extension can detect slow tests in `phpunit/phpunit`, you need to bootstrap it. The bootstrapping mechanism depends on the version of `phpunit/phpunit` you are using.\n\n### Bootstrapping the extension as a `composer` package\n\nTo bootstrap the extension as a `composer` package when using\n\n- `phpunit/phpunit:^12.0.0`\n- `phpunit/phpunit:^11.0.0`\n- `phpunit/phpunit:^10.0.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`extensions` element](https://docs.phpunit.de/en/10.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)\n- [`extensions` element](https://docs.phpunit.de/en/11.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)\n- [`extensions` element](https://docs.phpunit.de/en/12.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^12.0.0`](https://docs.phpunit.de/en/12.0/)\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n+    \u003cextensions\u003e\n+        \u003cbootstrap class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+    \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n         \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n---\n\nTo bootstrap the extension as a `composer` package when using\n\n- `phpunit/phpunit:^9.0.0`\n- `phpunit/phpunit:^8.5.19`\n- `phpunit/phpunit:^7.5.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`extensions` element](https://docs.phpunit.de/en/7.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^7.5.0`](https://docs.phpunit.de/en/7.5/)\n- [`extensions` element](https://docs.phpunit.de/en/8.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^8.5.19`](https://docs.phpunit.de/en/8.5/)\n- [`extensions` element](https://docs.phpunit.de/en/9.6/configuration.html#the-extensions-element) on [`phpunit/phpunit:^9.0.0`](https://docs.phpunit.de/en/9.6/)\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n+    \u003cextensions\u003e\n+        \u003cextension class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+    \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n         \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n---\n\nTo bootstrap the extension as a `composer` package when using\n\n- `phpunit/phpunit:^6.5.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`listeners` element](https://phpunit.de/manual/6.5/en/appendixes.configuration.html#appendixes.configuration.test-listeners) on [`phpunit/phpunit:^6.5.0`](https://phpunit.de/manual/6.5/en/)\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n+    \u003clisteners\u003e\n+        \u003clistener class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+    \u003c/listeners\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n         \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n### Bootstrapping the extension as a PHAR\n\nTo bootstrap the extension as a PHAR when using\n\n- `phpunit/phpunit:^12.0.0`\n- `phpunit/phpunit:^11.0.0`\n- `phpunit/phpunit:^10.0.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/10.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/10.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/11.0/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/11.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/12.0/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/12.0/configuration.html#the-extensions-element) on [`phpunit/phpunit:^12.0.0`](https://docs.phpunit.de/en/12.0/)\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n+    extensionsDirectory=\"directory/where/you/saved/the/extension/phars\"\n \u003e\n+    \u003cextensions\u003e\n+        \u003cextension class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+    \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n         \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n---\n\nTo bootstrap the extension as a PHAR when using\n\n- `phpunit/phpunit:^9.0.0`\n- `phpunit/phpunit:^8.5.19`\n- `phpunit/phpunit:^7.5.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/7.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/7.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^7.5.0`](https://docs.phpunit.de/en/7.5/)\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/8.5/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/8.5/configuration.html#the-extensions-element) on [`phpunit/phpunit:^8.5.19`](https://docs.phpunit.de/en/8.5/)\n- [`extensionsDirectory` attribute](https://docs.phpunit.de/en/9.6/configuration.html#the-extensionsdirectory-attribute) and the [`extensions` element](https://docs.phpunit.de/en/9.6/configuration.html#the-extensions-element) on [`phpunit/phpunit:^9.0.0`](https://docs.phpunit.de/en/9.5/)\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n+    extensionsDirectory=\"directory/where/you/saved/the/extension/phars\"\n \u003e\n+    \u003cextensions\u003e\n+        \u003cbootstrap class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+    \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n         \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n### Configuring the extension\n\nYou can configure the extension with the following options in your `phpunit.xml` configuration file:\n\n- `maximum-count`, an `int`, the maximum count of slow test that should be reported, defaults to `10`\n- `maximum-duration`, an `int`, the maximum duration in milliseconds for a test before the extension considers it as a slow test, defaults to `500`\n\nThe configuration mechanism depends on the version of `phpunit/phpunit` you are using.\n\n### Configuring the extension\n\nTo configure the extension when using\n\n- `phpunit/phpunit:^12.0.0`\n- `phpunit/phpunit:^11.0.0`\n- `phpunit/phpunit:^10.0.0`\n\nadjust your `phpunit.xml` configuration file and configure one or more\n\n- [`parameter` elements](https://docs.phpunit.de/en/10.5/configuration.html#the-parameter-element) on [`phpunit/phpunit:^10.0.0`](https://docs.phpunit.de/en/10.5/)\n- [`parameter` elements](https://docs.phpunit.de/en/11.0/configuration.html#the-parameter-element) on [`phpunit/phpunit:^11.0.0`](https://docs.phpunit.de/en/11.0/)\n- [`parameter` elements](https://docs.phpunit.de/en/12.0/configuration.html#the-parameter-element) on [`phpunit/phpunit:^12.0.0`](https://docs.phpunit.de/en/12.0/)\n\nThe following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds:\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n     \u003cextensions\u003e\n-        \u003cbootstrap class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+        \u003cbootstrap class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"\u003e\n+            \u003cparameter name=\"maximum-count\" value=\"3\"/\u003e\n+            \u003cparameter name=\"maximum-duration\" value=\"250\"/\u003e\n+        \u003c/bootstrap\u003e\n     \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n        \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n---\n\nTo configure the extension when using\n\n- `phpunit/phpunit:^9.0.0`\n- `phpunit/phpunit:^8.5.19`\n- `phpunit/phpunit:^7.5.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`arguments` element](https://docs.phpunit.de/en/7.5/configuration.html#the-arguments-element) on [`phpunit/phpunit:^7.5.0`](https://docs.phpunit.de/en/7.5/)\n- [`arguments` element](https://docs.phpunit.de/en/8.5/configuration.html#the-arguments-element) on [`phpunit/phpunit:^8.5.19`](https://docs.phpunit.de/en/8.5/)\n- [`arguments` element](https://docs.phpunit.de/en/9.6/configuration.html#the-arguments-element) on [`phpunit/phpunit:^9.0.0`](https://docs.phpunit.de/en/9.6/)\n\nThe following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds:\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n     \u003cextensions\u003e\n-        \u003cextension class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+        \u003cextension class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"\u003e\n+            \u003carguments\u003e\n+                \u003carray\u003e\n+                    \u003celement key=\"maximum-count\"\u003e\n+                        \u003cinteger\u003e3\u003c/integer\u003e\n+                    \u003c/element\u003e\n+                    \u003celement key=\"maximum-duration\"\u003e\n+                        \u003cinteger\u003e250\u003c/integer\u003e\n+                    \u003c/element\u003e\n+                \u003c/array\u003e\n+            \u003c/arguments\u003e\n+        \u003c/extension\u003e\n     \u003c/extensions\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n        \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n---\n\nTo configure the extension when using\n\n- `phpunit/phpunit:^6.5.0`\n\nadjust your `phpunit.xml` configuration file and configure the\n\n- [`arguments` element](https://phpunit.de/manual/6.5/en/appendixes.configuration.html#appendixes.configuration.test-listeners) on [`phpunit/phpunit:^6.5.0`](https://phpunit.de/manual/6.5/en/)\n\nThe following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds:\n\n```diff\n \u003cphpunit\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n     xsi:noNamespaceSchemaLocation=\"vendor/phpunit/phpunit/phpunit.xsd\"\n     bootstrap=\"vendor/autoload.php\"\n \u003e\n     \u003clisteners\u003e\n-        \u003clistener class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"/\u003e\n+        \u003clistener class=\"Ergebnis\\PHPUnit\\SlowTestDetector\\Extension\"\u003e\n+            \u003carguments\u003e\n+                \u003carray\u003e\n+                    \u003celement key=\"maximum-count\"\u003e\n+                        \u003cinteger\u003e3\u003c/integer\u003e\n+                    \u003c/element\u003e\n+                    \u003celement key=\"maximum-duration\"\u003e\n+                        \u003cinteger\u003e250\u003c/integer\u003e\n+                    \u003c/element\u003e\n+                \u003c/array\u003e\n+            \u003c/arguments\u003e\n+        \u003c/listener\u003e\n     \u003c/listeners\u003e\n     \u003ctestsuites\u003e\n         \u003ctestsuite name=\"unit\"\u003e\n             \u003cdirectory\u003etest/Unit/\u003c/directory\u003e\n        \u003c/testsuite\u003e\n     \u003c/testsuites\u003e\n \u003c/phpunit\u003e\n```\n\n### Configuring the maximum duration per test case\n\nYou can configure the maximum duration for a single test case with\n\n- an `Attribute\\MaximumDuration` attribute when using\n  - `phpunit/phpunit:^12.0.0`\n  - `phpunit/phpunit:^11.0.0`\n  - `phpunit/phpunit:^10.0.0`\n- a `@maximumDuration` annotation in the DocBlock when using\n  - `phpunit/phpunit:^9.0.0`\n  - `phpunit/phpunit:^8.5.19`\n  - `phpunit/phpunit:^7.5.0`\n  - `phpunit/phpunit:^6.5.0`\n- a `@slowThreshold` annotation in the DocBlock when using\n  - `phpunit/phpunit:^9.0.0`\n  - `phpunit/phpunit:^8.5.19`\n  - `phpunit/phpunit:^7.5.0`\n  - `phpunit/phpunit:^6.5.0`\n\nThe following example configures the maximum durations for single test cases to 5,000 ms, 4,000 ms, and 3,000 ms:\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nuse PHPUnit\\Framework;\nuse Ergebnis\\PHPUnit\\SlowTestDetector;\n\nfinal class ExtraSlowTest extends Framework\\TestCase\n{\n    #[SlowTestDetector\\Attribute\\MaximumDuration(5000)]\n    public function testExtraExtraSlow(): void\n    {\n        // ...\n    }\n\n    /**\n     * @maximumDuration 4000\n     */\n    public function testAlsoQuiteSlow(): void\n    {\n        // ...\n    }\n\n    /**\n     * @slowThreshold 3000\n     */\n    public function testQuiteSlow(): void\n    {\n        // ...\n    }\n}\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e Support for the `@slowThreshold` annotation exists only to help you move from [`johnkary/phpunit-speedtrap`](https://github.com/johnkary/phpunit-speedtrap). It will be deprecated and removed in the near future.\n\n### Running tests\n\nWhen you have bootstrapped the extension, you can run your tests as usually:\n\n```sh\nvendor/bin/phpunit\n```\n\nWhen the extension has detected slow tests, it will report them:\n\n```console\nPHPUnit 10.0.0 by Sebastian Bergmann and contributors.\n\nRuntime:       PHP 8.1.0\nConfiguration: test/EndToEnd/Default/phpunit.xml\nRandom Seed:   1676103726\n\n.............                                                                                                                                                                                                                                                                                                   13 / 13 (100%)\n\nDetected 11 tests where the duration exceeded the maximum duration.\n\n 1. 00:01.604 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#9\n 2. 00:01.505 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#8\n 3. 00:01.403 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#7\n 4. 00:01.303 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#6\n 5. 00:01.205 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#5\n 6. 00:01.103 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#4\n 7. 00:01.005 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#3\n 8. 00:00.905 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#2\n 9. 00:00.805 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#1\n10. 00:00.705 (00:00.500) Ergebnis\\PHPUnit\\SlowTestDetector\\Test\\EndToEnd\\Default\\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#0\n\nThere is 1 additional slow test that is not listed here.\n\nTime: 00:12.601, Memory: 8.00 MB\n\nOK (13 tests, 13 assertions)\n```\n\n### Understanding measured test durations\n\n#### Understanding measured test durations when using the new event system\n\nWhen using\n\n- `phpunit/phpunit:^12.0.0`\n- `phpunit/phpunit:^11.0.0`\n- `phpunit/phpunit:^10.0.0`\n\nthe extension uses the new event system of `phpunit/phpunit`, and measures the duration between the points in time when the [`PHPUnit\\Event\\Test\\PreparationStarted`](https://github.com/sebastianbergmann/phpunit/blob/10.0.0/src/Event/Events/Test/Lifecycle/PreparationStarted.php#L22-L50) and [`PHPUnit\\Event\\Test\\Finished`](https://github.com/sebastianbergmann/phpunit/blob/10.0.0/src/Event/Events/Test/Lifecycle/Finished.php#L22-L57) are emitted.\n\n#### Understanding measured test durations when using the hooks event system\n\nWhen using\n\n- `phpunit/phpunit:^9.0.0`\n- `phpunit/phpunit:^8.5.19`\n- `phpunit/phpunit:^7.5.0`\n- `phpunit/phpunit:^6.5.0`\n\nthe extension uses the hooks event system of `phpunit/phpunit`, and measures the duration that is passed to the [`PHPUnit\\Runner\\AfterTestHook`](https://github.com/sebastianbergmann/phpunit/blob/7.5.0/src/Runner/Hook/AfterTestHook.php#L12-L21). This is the [duration of invoking `PHPUnit\\Framework\\TestCase::runBare()` and more](https://github.com/sebastianbergmann/phpunit/blob/8.5.19/src/Framework/TestResult.php#L671-L754).\n\n\u003e [!NOTE]\n\u003e Because of this behavior, the measured test durations can and will vary depending on the order in which `phpunit/phpunit` executes tests.\n\n## Changelog\n\nThe maintainers of this project record notable changes to this project in a [changelog](CHANGELOG.md).\n\n## Contributing\n\nThe maintainers of this project suggest following the [contribution guide](.github/CONTRIBUTING.md).\n\n## Code of Conduct\n\nThe maintainers of this project ask contributors to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).\n\n## General Support Policy\n\nThe maintainers of this project provide limited support.\n\nYou can support the maintenance of this project by [sponsoring @ergebnis](https://github.com/sponsors/ergebnis).\n\n## PHP Version Support Policy\n\nThis project supports PHP versions with [active and security support](https://www.php.net/supported-versions.php).\n\nThe maintainers of this project add support for a PHP version following its initial release and drop support for a PHP version when it has reached the end of security support.\n\n## Security Policy\n\nThis project has a [security policy](.github/SECURITY.md).\n\n## License\n\nThis project uses the [MIT license](LICENSE.md).\n\n## Credits\n\nThis package is inspired by [`johnkary/phpunit-speedtrap`](https://github.com/johnkary/phpunit-speedtrap), originally licensed under MIT by [John Kary](https://github.com/johnkary).\n\n## Social\n\nFollow [@localheinz](https://twitter.com/intent/follow?screen_name=localheinz) and [@ergebnis](https://twitter.com/intent/follow?screen_name=ergebnis) on Twitter.\n","funding_links":["https://github.com/sponsors/ergebnis","https://github.com/sponsors/localheinz"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fphpunit-slow-test-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fergebnis%2Fphpunit-slow-test-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergebnis%2Fphpunit-slow-test-detector/lists"}