Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option stopOnSlow halts execution upon first slow test #82

Merged
merged 1 commit into from
Mar 14, 2021

Conversation

johnkary
Copy link
Owner

Alternate implementation for #64. Thanks @PeterDKC for proposing this idea.

Some test suites run for a long time. PHPUnit already supports command-line options for halting execution when different test result types are first encountered. This allows more quickly notifying developers about problems in the test suite.

  • --stop-on-error
  • --stop-on-failure
  • --stop-on-warning
  • --stop-on-risky
  • --stop-on-skipped
  • --stop-on-incomplete

This PR proposes a new SpeedTrap option stopOnSlow to stop execution upon the first slow test.

The option is controlled using phpunit.xml like other SpeedTrap options:

<phpunit bootstrap="vendor/autoload.php">
    <!-- ... other suite configuration here ... -->

    <listeners>
        <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener">
            <arguments>
                <array>
                    ...
                    <element key="stopOnSlow">
                        <boolean>false</boolean>
                    </element>
                </array>
            </arguments>
        </listener>
    </listeners>
</phpunit>

What does it look like when the test suite halts due to a slow test?

The slowness report displays with the single slow test, followed by PHPUnit's normal test runner report.

Screenshot 2021-02-28 11 06 36 png@2x

@johnkary johnkary added this to the 4.0 milestone Feb 28, 2021
@johnkary johnkary self-assigned this Feb 28, 2021
@johnkary johnkary merged commit b2f2226 into master Mar 14, 2021
@johnkary johnkary deleted the stop-on-slow branch March 14, 2021 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant