[wp-trac] [WordPress Trac] #39265: Missing @covers and @uses in the comments block in phpunt test for wordpress

WordPress Trac noreply at wordpress.org
Tue Mar 21 19:37:15 UTC 2017


#39265: Missing @covers and @uses in the comments block in phpunt test for
wordpress
------------------------------+------------------------------
 Reporter:  pbearne           |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+------------------------------

Comment (by jnylen0):

 While I am definitely a proponent of thorough unit tests, I am -1 on
 adding annotations for code coverage, and in general I think the `@covers`
 annotation is not a good idea.  I will try to explain why.

 Someone will have to update every single test to indicate which functions
 are covered.  This will be a manual process requiring an enormous amount
 of effort, not only now, but in perpetuity.  I can't speak for everyone
 but I personally don't want to do this in my patches.

 It is virtually guaranteed that tests will not be consistently updated
 with `@covers` annotations in the future.  (It's hard enough to ensure
 that tests are written in the first place.)  Even if we do a huge effort
 now to add them, the coverage reports will become essentially useless in
 the future due to attrition.

 Per-function coverage is not a very useful thing to report on.  Consider:
 `@covers wp_update_post`.  This is a very long function with a lot of
 complicated logic.  Line-by-line coverage reporting is far more useful.

 I don't want to read lots of lines of `@covers` and other annotations in
 the test code.  I think we already have too many of these annotations and
 they are just visual noise, because the information about which functions
 are called is already present in the test code itself.

 I would be far more interested in an effort to provide '''automated'''
 code coverage reports on a line-by-line basis, perhaps with results split
 by WordPress component or something like that.  I do think this would be
 really valuable, and once it's set up, there's far less ongoing
 maintenance required.

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


More information about the wp-trac mailing list