You can install the package via composer:
composer require maurobaptista/phpunit-slow-tests --dev
In your phpunit.xml
file, add the extensions as below.
<extensions>
<extension class="MauroBaptista\SlowTests\Extensions\ResultToCSV">
<arguments>
<string>tests/report/result.csv</string>
</arguments>
</extension>
<extension class="MauroBaptista\SlowTests\Extensions\SlowestTests" />
</extensions>
A CSV export of the time of all ran tests will be stored in this file.
<extensions>
<extension class="MauroBaptista\SlowTests\Extensions\ResultToCSV">
<arguments>
<string>tests/report/result.csv</string>
</arguments>
</extension>
</extensions>
Arguments:
Argument | Type | Default | Note |
---|---|---|---|
file | string | result.csv |
Path to the file (can be a relative path) |
Output:
Console:
File:
datetime,class,method,duration
"2022-11-08 02:06:23","Tests\Unit\ExampleTest",that_true_is_true,0.0055065
"2022-11-08 02:06:23","Tests\Feature\ExampleTest",that_true_is_true,0.186276667
<extensions>
<extension class="MauroBaptista\SlowTests\Extensions\SlowestTests">
<arguments>
<integer>10</integer>
<array>
<element key="success">
<double>0.1</double>
</element>
<element key="warning">
<double>1</double>
</element>
</array>
</arguments>
</extension>
</extensions>
Arguments:
Argument | Type | Default | Note |
---|---|---|---|
show | integer | 10 | Amount of tests that will be shown after the test ran |
threshold | array | ['success' => 0.1, 'warning' => 1] |
Time to show tests as green, yellow, or red (in seconds) |
Output:
Console:
composer test
The MIT License (MIT). Please see License File for more information.