DateRangeFieldTest should not use a data provider

Created on 19 April 2024, 8 months ago
Updated 6 May 2024, 8 months ago

Problem/Motivation

This test is taking about 5 minutes, most functional tests complete in under 4 minutes.

We should split the data providers out to their own test classes and just leave the one-off methods in here - so three test classes instead of one.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.3 ✨

Component
DatetimeΒ  β†’

Last updated 6 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @catch
  • Merge request !7624Split the to/from test out to its own class. β†’ (Open) created by catch
  • Status changed to Needs review 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch
  • Pipeline finished with Success
    8 months ago
    Total: 1053s
    #152041
  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    Drupal\Tests\datetime_range\Functional\DateRangeFieldFromToTest 27 passes - still over 5 minutes.

    Might need to do this without a data provider and handle the 27 variations with the test itself.

  • Status changed to Needs review 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    Sometimes you just need a foreach loop.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Locally the test finishes in 30 seconds, now, so approximately 1/20th the time.

  • πŸ‡¬πŸ‡§United Kingdom catch

    This is fast enough it's fine in the main class now, moved back and re-titling. So the only change here is to use a foreach loop for each variation instead of a full install of Drupal each time.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I ran the test, just once, results below, with and without the diff and I reviewed the MR. I am not fond on describing methods as 'helpers' and I left a suggestion in the MR.

    Before
    real 8m11.738s
    user 0m0.077s
    sys 0m0.054s

    After
    real 0m23.966s
    user 0m0.068s
    sys 0m0.014s

  • Pipeline finished with Success
    8 months ago
    Total: 992s
    #152349
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Love it. I do stuff like this a lot in tests. I basically can't stand to see data providers in Functional tests, and heaven-forbid in FunctionalJavaScript.

    The results in #8 are mind blowing, given the small size of the diff. 8:11 to 0:24 is more than a 20X speedup. πŸ˜‚

    Ship it!

    Thanks,
    -Derek

    • quietone β†’ committed 03f20224 on 11.x
      Issue #3442176 by catch, dww: DateRangeFieldTest should not use a data...
    • quietone β†’ committed 38a5234b on 10.3.x
      Issue #3442176 by catch, dww: DateRangeFieldTest should not use a data...
  • Status changed to Fixed 8 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I do like using less resources to do task.

    Committed and pushed to 11.x and 10.3.x. Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024