[wp-trac] [WordPress Trac] #30017: Many automated tests are unnecessarily slow

WordPress Trac noreply at wordpress.org
Fri Oct 17 02:07:20 UTC 2014


#30017: Many automated tests are unnecessarily slow
------------------------------+----------------------------
 Reporter:  boonebgorges      |      Owner:
     Type:  task (blessed)    |     Status:  new
 Priority:  normal            |  Milestone:  Future Release
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:  performance       |
------------------------------+----------------------------
 Our test suite is getting bigger (that's good!). But many of our tests
 are, of necessity, integration and functional tests that require lots of
 setup: creating factory data, resetting globals, etc. This process can be
 slow (that's bad!).

 Poking around in the tests, it looks like some of the worst offenders are
 those who create lots of database content in the `setUp()` method.
 Creating more dummy data than is absolutely necessary to test an assertion
 is - at best - wasteful. At worst, it actually introduces unnecessary
 variables into what is supposed to be a narrowly defined test. (Fake but
 illustrative example: if you create 25 posts to test some default value in
 `WP_Query`, you now have to worry about pagination in addition to whatever
 value you're testing.)

 Changing existing tests is a tedious and potentially dangerous task - you
 don't want to introduce regressions into our regression-preventing tests.
 But if we can shave 10-20% off of the execution time of our suite (which I
 think is a pretty conservative estimate), it'd be a huge step toward
 getting more people to actually run the dang things, as well as things
 like continuous integration.

 Opening this ticket for discussion and/or patches.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30017>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list