[wp-hackers] Process for submitting new unit tests

Ian Dunn ian at iandunn.name
Tue Jan 29 05:22:16 UTC 2013

The intro section of the Automated Testing page on the Codex says,

"The process to add your test suite and test cases to existing suites is 
to add them to the WordPress Core Trac ticket that has the bug that the 
test case or suite tests. After you've done this, add "unit-tested" to 
the keywords of the ticket to inform the lead developers that it has 
been added." -- 

...but the Submitting the Test Cases section at the end says,

" New test cases should be submitted to the main WordPress trac, setting 
the component to 'Unit Tests.' These will then get reviewed and added to 
the Subversion repository." -- 

So, the first paragraph says to attach new tests to the ticket the tests 
were written for, while the other paragraph says to open a second ticket 
whose only purpose would be submitting the new tests for inclusion in 
the suite.

Can someone tell me which one is correct? I can fix the article once I 
find out.

Also, the article doesn't offer much in the way of guidance on what 
kinds of new tests are desired, or how extensive they should be. I'm 
working on some small modifications to wp_mail() in #23291, and they're 
relatively straight forward, but I still want to be cautious about any 
unintended consequences. The current suite only has 6 tests for 
wp_mail(), so there's a lot that could go wrong without being detected.

I'm probably going to write at least half a dozen tests just for my own 
sanity, but I can submit them to the tests repo if that's desired. I 
know some people consider excessive unit testing a waste of time, or 
might not want to see the suite grow to the tens of thousands, or prefer 
system testing and don't want to bother updating unit tests when 
internals change. Is there a consensus on what should be in the suite, 
or any official guidelines?

More information about the wp-hackers mailing list