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

Consistently include test setup and teardown in duration measurement #380

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Nov 28, 2023

fix #378, measure the whole TestCase::runBare() duration

also measure any test, not only the successful ones, measuring failed/errored tests is helpful especially for tests using IO or external services

@mvorisek mvorisek force-pushed the include_teardown branch 2 times, most recently from 664e23d to 3fc2545 Compare November 28, 2023 11:12
@mvorisek mvorisek marked this pull request as ready for review December 1, 2023 10:24
@localheinz localheinz self-assigned this Dec 1, 2023
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (d94c5ad) 70.54% compared to head (e418bd4) 69.86%.

Files Patch % Lines
src/Extension.php 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #380      +/-   ##
============================================
- Coverage     70.54%   69.86%   -0.68%     
  Complexity      110      110              
============================================
  Files            26       26              
  Lines           516      521       +5     
============================================
  Hits            364      364              
- Misses          152      157       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@localheinz
Copy link
Member

@mvorisek

Two things:

  • I do not believe this extension should report slow tests that have not passed. When I have a test suite where a test has not passed, I would fix the failing test first, and improve the speed of passing tests second.
  • If we want to (somewhat) consistently report slow tests across phpunit/phpunit:^8.5.19, phpunit/phpunit:^9.0.0, and phpunit/phpunit:^10.0.0, then the extension should probably

What do you think?

@mvorisek mvorisek force-pushed the include_teardown branch 4 times, most recently from e22cf77 to 694e831 Compare December 4, 2023 17:58
@mvorisek
Copy link
Contributor Author

mvorisek commented Dec 4, 2023

I do not believe this extension should report slow tests that have not passed. When I have a test suite where a test has not passed, I would fix the failing test first, and improve the speed of passing tests second.

I belive it should. When failed test failed fast, it is never reported. And in general, tests do not fail slower than when passed fully.

But if a failed test took longer than a maximum duration, it should be reported to make the developer aware there is also some slowness issue. Especially when run remotely/in CI.

If we want to (somewhat) consistently report slow tests across phpunit/phpunit:^8.5.19, phpunit/phpunit:^9.0.0, and phpunit/phpunit:^10.0.0, then the extension should probably

I am looking into the PHPUnit v8/9 hooks to make the behaviour consistent.

@mvorisek mvorisek changed the title Include test teardown in time measurement Include test setup/teardown in time measurement consistently Dec 4, 2023
@mvorisek mvorisek force-pushed the include_teardown branch 2 times, most recently from b06a140 to 8070633 Compare December 4, 2023 20:44
@mvorisek mvorisek force-pushed the include_teardown branch 3 times, most recently from 33d6fe2 to c9c42f7 Compare December 8, 2023 23:31
@mvorisek
Copy link
Contributor Author

Rebased.

@localheinz
Copy link
Member

@mvorisek

Don't worry about rebasing, I'm working on it and will finish it in a moment!

@localheinz localheinz force-pushed the include_teardown branch 4 times, most recently from e744cbb to dee1111 Compare December 23, 2023 16:04
@localheinz localheinz changed the title Include test setup/teardown in time measurement consistently Consistently include test setup and teardown in duration measurement Dec 23, 2023
Co-authored-by: Andreas Möller <[email protected]>
Co-authored-by: Michael Voříšek <[email protected]>
@localheinz localheinz merged commit f3849f2 into ergebnis:main Dec 23, 2023
37 of 39 checks passed
@localheinz
Copy link
Member

Thank you, @mvorisek!

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.

Measured time must include test setup/teardown
2 participants