[wp-trac] [WordPress Trac] #53119: Tests: introduce naming conventions for data providers and use named test cases

WordPress Trac noreply at wordpress.org
Fri Apr 30 20:57:24 UTC 2021


#53119: Tests: introduce naming conventions for data providers and use named test
cases
------------------------------+------------------------------
 Reporter:  jrf               |       Owner:  (none)
     Type:  task (blessed)    |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:  docs
------------------------------+------------------------------

Comment (by hellofromTonya):

 Replying to [comment:5 pbiron]:
 > I know...the point I was trying to make is the provider for `test1` is
 not ''immediately'' following it.  The provider is after `test3`, so a
 contributor would still have to "jump around" to find it's provider...just
 as they would for finding the provider for `test3` if all providers were
 at the bottom of the class.

 You're right. When there's a group of tests with a data provider (all
 grouped together), it does not eliminate needing to jump down from `test1`
 to the data provider.

 That said, (IMO) it does provide flow via grouping like tests together
 with their shared test data. That flow can aid in reducing cognitive
 complexity when reading the code.

 Replying to [comment:5 pbiron]:
 >Again, I welcome the proposal as written, but personally would find it
 easier if I could know that all providers were at the bottom of the class.

 Thanks for sharing how you structure your tests.

 Both the proposal and your way provide consistency when applied
 consistently. Both can aid in making the test suite more consistent.
 Consistency can help contributors to know how to structure tests. That's a
 win.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53119#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list