johnkary / phpunit-speedtrap

Reports on slow-running tests in your PHPUnit test suite
MIT License
783 stars 62 forks source link

Adds the option to fail on the first slow test rather than continuing #64

Closed PeterDKC closed 3 years ago

PeterDKC commented 5 years ago

Justification:

I'm working on an application with > 3700 tests. The last time I tried to run the suite locally, I Ctrl-C'd after 6 hours. The test progress had reached a whopping 35%. It's a known problem that "some number of tests" (read: hundreds) exceed 5min run time but it's obviously extremely painful for the dev team to identify which ones need attention.

I would really love to add Speed Trap to this project but unfortunately there's just no way to let the entire suite run in full.

What changes:

This change allows for a flag to stop the suite upon the first test that exceeds the configured Slow Threshold.

PeterDKC commented 5 years ago

Hi @johnkary Any update on this one? :)

localheinz commented 3 years ago

@johnkary @PeterDKC

Note that this will not be supported in the new event system of phpunit/phpunit.

PeterDKC commented 3 years ago

@localheinz I don't work for the company where this was needed anymore. I vaguely remember taking a look at the event stuff in phpunit when I made this PR and couldn't make heads or tails of how to use any of it. It's far from obvious how any of that works. 🤷‍♂️

johnkary commented 3 years ago

@PeterDKC Thank you for suggesting this idea!

I have proposed #82 as an alternate implementation that more closely follows PHPUnit's naming conventions, and has added benefit of displaying PHPUnit's normal test runner output.

PeterDKC commented 3 years ago

@johnkary looks great to me. Closing this one. 👍