Many automated tests are unnecessarily slow
|Reported by:||boonebgorges||Owned by:||wonderboymusic|
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.
Change History (67)
- Keywords ongoing added
- Milestone changed from 4.4 to Future Release
- Owner set to wonderboymusic
- Status changed from new to assigned