Skip to content

Consider printing slow test report after phpunit/phpunit has printed its own output #777

Description

@localheinz

Right now the report is printed before phpunit/phpunit has printed its own output - which feels like a violation to me.

Before

See https://github.com/sebastianbergmann/phpunit/blob/10.0.0/src/TextUI/TestRunner.php#L65.

PHPUnit 10.5.63 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.34
Configuration: /app/work/test/Phar/PHPUnit10/phpunit.xml
Extension:     ergebnis/phpunit-slow-test-detector 2.23.0
Random Seed:   1771838601

.....                                                               5 / 5 (100%)

Detected 4 tests where the duration exceeded the global maximum duration (0.050).

# Duration Test
----------------------------------------------------------------------------------------------------------------------------------
1    0.156 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredAndFiftyMilliseconds
2    0.130 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredAndTwentyFiveMilliseconds
3    0.104 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredMilliseconds
4    0.077 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsSeventyFiveMilliseconds
----------------------------------------------------------------------------------------------------------------------------------
     0.000
      └─── seconds

Time: 00:00.473, Memory: 8.00 MB

OK (5 tests, 5 assertions)

After

See https://github.com/sebastianbergmann/phpunit/blob/10.0.0/src/TextUI/Application.php#L175.

PHPUnit 10.5.63 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.34
Configuration: /app/work/test/Phar/PHPUnit10/phpunit.xml
Extension:     ergebnis/phpunit-slow-test-detector 2.23.0
Random Seed:   1771838601

.....                                                               5 / 5 (100%)

Time: 00:00.473, Memory: 8.00 MB

OK (5 tests, 5 assertions)

Detected 4 tests where the duration exceeded the global maximum duration (0.050).

# Duration Test
----------------------------------------------------------------------------------------------------------------------------------
1    0.156 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredAndFiftyMilliseconds
2    0.130 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredAndTwentyFiveMilliseconds
3    0.104 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsOneHundredMilliseconds
4    0.077 Ergebnis\PHPUnit\SlowTestDetector\Test\Phar\PHPUnit10\SleeperTest::testSleeperSleepsSeventyFiveMilliseconds
----------------------------------------------------------------------------------------------------------------------------------
     0.000
      └─── seconds

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions