[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 18:02:51 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:1 pbiron]:
 > I would, however, recommend one change to the proposal: put all data
 providers at the bottom of the class, regardless of which tests they are
 used for.
 >
 > I think that simplification/consistency would be easier for contributors
 to "grasp".

 IMO moving all the data providers to the bottom of the class can cause a
 "reading" and "understanding" disconnect between a test and its data. Why?
 The distance between the test and its data requires action to jump between
 the different locations in the class. This navigating "action" is a break
 in the reading which can cause cognitive effort and load.

 Think of it in terms of reading a book. Imagine a chapter where the
 details of the story are moved to the end of the book rather than
 appearing in the next paragraph to support the flow of the story.

 The test's data is the richness of the test. The test and its data are one
 unit.

 For me, I find keeping the test and its data grouped together like this to
 flow better without the cognitive effort from jumping around:

 test1
 dataProvider1

 test2
 dataProvider2

 test3
 test4
 dataProvider34

 test5
 test6

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


More information about the wp-trac mailing list