Skip to content

Commit 0e9d875

Browse files
committed
Fix: Move example to top of README.md
1 parent 30d80d7 commit 0e9d875

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

README.md

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,41 @@
1313

1414
This 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).
1515

16+
## Example
17+
18+
After installing, configuring, and bootstrapping the extension, when running your tests with `phpunit/phpunit`, the extension will report slow tests:
19+
20+
```console
21+
PHPUnit 10.0.0 by Sebastian Bergmann and contributors.
22+
23+
Runtime: PHP 8.1.0
24+
Configuration: test/EndToEnd/Default/phpunit.xml
25+
Random Seed: 1676103726
26+
27+
............. 13 / 13 (100%)
28+
29+
Detected 11 tests where the duration exceeded the global maximum duration (00:00.500).
30+
31+
1. 00:01.604 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#9
32+
2. 00:01.505 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#8
33+
3. 00:01.403 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#7
34+
4. 00:01.303 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#6
35+
5. 00:01.205 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#5
36+
6. 00:01.103 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#4
37+
7. 00:01.005 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#3
38+
8. 00:00.905 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#2
39+
9. 00:00.805 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#1
40+
10. 00:00.705 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#0
41+
42+
There is 1 additional slow test that is not listed here.
43+
44+
Time: 00:12.601, Memory: 8.00 MB
45+
46+
OK (13 tests, 13 assertions)
47+
```
48+
49+
## Compatibility
50+
1651
The extension is compatible with the following versions of `phpunit/phpunit`:
1752

1853
- [`phpunit/phpunit:^13.0.0`](https://github.com/sebastianbergmann/phpunit/tree/13.0.0)
@@ -397,45 +432,6 @@ final class ExtraSlowTest extends Framework\TestCase
397432
>
398433
> 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.
399434
400-
### Running tests
401-
402-
When you have bootstrapped the extension, you can run your tests as usually:
403-
404-
```sh
405-
vendor/bin/phpunit
406-
```
407-
408-
When the extension has detected slow tests, it will report them:
409-
410-
```console
411-
PHPUnit 10.0.0 by Sebastian Bergmann and contributors.
412-
413-
Runtime: PHP 8.1.0
414-
Configuration: test/EndToEnd/Default/phpunit.xml
415-
Random Seed: 1676103726
416-
417-
............. 13 / 13 (100%)
418-
419-
Detected 11 tests where the duration exceeded the global maximum duration (00:00.500).
420-
421-
1. 00:01.604 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#9
422-
2. 00:01.505 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#8
423-
3. 00:01.403 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#7
424-
4. 00:01.303 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#6
425-
5. 00:01.205 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#5
426-
6. 00:01.103 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#4
427-
7. 00:01.005 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#3
428-
8. 00:00.905 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#2
429-
9. 00:00.805 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#1
430-
10. 00:00.705 Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Default\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider#0
431-
432-
There is 1 additional slow test that is not listed here.
433-
434-
Time: 00:12.601, Memory: 8.00 MB
435-
436-
OK (13 tests, 13 assertions)
437-
```
438-
439435
### Understanding measured test durations
440436

441437
#### Understanding measured test durations when using the new event system

0 commit comments

Comments
 (0)