From 0abc328f2dfb9e02810e19359e972bcdc94a3921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 10 Feb 2023 22:32:57 +0100 Subject: [PATCH] Fix: Adjust defaults --- CHANGELOG.md | 2 ++ README.md | 4 ++-- src/Extension.php | 4 ++-- test/EndToEnd/MaximumCount/Default/test.phpt | 9 +++------ test/EndToEnd/MaximumCount/Five/test.phpt | 11 +++-------- test/EndToEnd/MaximumDuration/Default/test.phpt | 9 +++------ test/EndToEnd/MaximumDuration/Fifty/test.phpt | 7 +++++-- 7 files changed, 20 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc43abd3..36fc926c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ For a full diff see [`1.0.0...main`][1.0.0...main]. ### Fixed - Removed possibility to configure maximum count of reported tests using the `MAXIMUM_NUMBER` environment variable ([#211]), by [@localheinz] +- Increased default maximum count from `3` to `10` and default maximum duration from `125` to `500` milliseconds ([#218]), by [@localheinz] ## [`1.0.0`][1.0.0] @@ -80,5 +81,6 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0]. [#211]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/211 [#212]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/212 [#217]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/217 +[#218]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/218 [@localheinz]: https://github.com/localheinz diff --git a/README.md b/README.md index 9357cf09..cc3be544 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,8 @@ To bootstrap the extension, adjust your `phpunit.xml` configuration file: You can configure the extension with the following parameters in your `phpunit.xml` configuration file: -- `maximum-count`, an `int`, the maximum count of slow test that should be listed, defaults to `3` -- `maximum-duration`, an `int`, the maximum duration in milliseconds for all tests, defaults to `250` +- `maximum-count`, an `int`, the maximum count of slow test that should be listed, defaults to `10` +- `maximum-duration`, an `int`, the maximum duration in milliseconds for all tests, defaults to `500` The following example configures the maximum count of slow tests to three, and the maximum duration for all tests to 250 milliseconds: diff --git a/src/Extension.php b/src/Extension.php index bb390f25..f7d6a903 100644 --- a/src/Extension.php +++ b/src/Extension.php @@ -23,13 +23,13 @@ public function bootstrap( Runner\Extension\Facade $facade, Runner\Extension\ParameterCollection $parameters, ): void { - $maximumCount = MaximumCount::fromInt(3); + $maximumCount = MaximumCount::fromInt(10); if ($parameters->has('maximum-count')) { $maximumCount = MaximumCount::fromInt((int) $parameters->get('maximum-count')); } - $maximumDuration = MaximumDuration::fromMilliseconds(125); + $maximumDuration = MaximumDuration::fromMilliseconds(500); if ($parameters->has('maximum-duration')) { $maximumDuration = MaximumDuration::fromMilliseconds((int) $parameters->get('maximum-duration')); diff --git a/test/EndToEnd/MaximumCount/Default/test.phpt b/test/EndToEnd/MaximumCount/Default/test.phpt index f999f395..396a8a4a 100644 --- a/test/EndToEnd/MaximumCount/Default/test.phpt +++ b/test/EndToEnd/MaximumCount/Default/test.phpt @@ -23,13 +23,10 @@ Random Seed: %s ......... 9 / 9 (100%) -Detected 8 tests that took longer than expected. +Detected 2 tests that took longer than expected. -1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond - 5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 - 4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt - -There are 5 additional slow tests that are not listed here. +1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond + 5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 Time: %s, Memory: %s diff --git a/test/EndToEnd/MaximumCount/Five/test.phpt b/test/EndToEnd/MaximumCount/Five/test.phpt index a9620238..682b67c5 100644 --- a/test/EndToEnd/MaximumCount/Five/test.phpt +++ b/test/EndToEnd/MaximumCount/Five/test.phpt @@ -23,15 +23,10 @@ Random Seed: %s ......... 9 / 9 (100%) -Detected 8 tests that took longer than expected. +Detected 2 tests that took longer than expected. -1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond - 5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 - 4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt - 4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithoutSlowThresholdAnnotation - 3%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsThreeHundredMilliseconds - -There are 3 additional slow tests that are not listed here. +1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond + 5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 Time: %s, Memory: %s diff --git a/test/EndToEnd/MaximumDuration/Default/test.phpt b/test/EndToEnd/MaximumDuration/Default/test.phpt index f999f395..396a8a4a 100644 --- a/test/EndToEnd/MaximumDuration/Default/test.phpt +++ b/test/EndToEnd/MaximumDuration/Default/test.phpt @@ -23,13 +23,10 @@ Random Seed: %s ......... 9 / 9 (100%) -Detected 8 tests that took longer than expected. +Detected 2 tests that took longer than expected. -1,0%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond - 5%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 - 4%s ms (125 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt - -There are 5 additional slow tests that are not listed here. +1,0%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond + 5%s ms (500 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 Time: %s, Memory: %s diff --git a/test/EndToEnd/MaximumDuration/Fifty/test.phpt b/test/EndToEnd/MaximumDuration/Fifty/test.phpt index ffd28ebb..1a319e3e 100644 --- a/test/EndToEnd/MaximumDuration/Fifty/test.phpt +++ b/test/EndToEnd/MaximumDuration/Fifty/test.phpt @@ -28,8 +28,11 @@ Detected 8 tests that took longer than expected. 1,0%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneSecond 5%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#1 4%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithSlowThresholdAnnotationWhereValueIsNotAnInt - -There are 5 additional slow tests that are not listed here. + 4%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithDocBlockWithoutSlowThresholdAnnotation + 3%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsThreeHundredMilliseconds + 2%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsWithSlowThresholdAnnotation#0 + 2%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsTwoHundredMilliseconds + 1%s ms (50 ms) Ergebnis\PHPUnit\SlowTestDetector\Test\Fixture\SleeperTest::testSleeperSleepsOneHundredFiftyMilliseconds Time: %s, Memory: %s