[wp-hackers] Unit Testing, Yet Another Discussion
sam at rephrase.net
Thu Aug 2 08:59:02 GMT 2007
On 8/2/07, jacobsantos at branson.com <jacobsantos at branson.com> wrote:
> #3 Has anyone else (besides the guy building the functional testing with
> SimpleTest, which is massively incomplete) started or finished their own
> unit testing suite of WordPress?
I started writing some tests with PHPUnit about a month ago, got
halfway through wp-includes/formatting.php and gave up.
There were a few reasons, the main one being that too much of the code
is very tightly-coupled: unit testing it is impossible without an
absurdly complicated harness. There didn't seem much point to only
testing the easily-tested functions -- most of them are stable anyway.
At this point I think there's more value in starting with higher-level
1. Tests of WP APIs: "if I call `wp_insert_post` with a title of
'foo', `the_title` returns 'foo'".
2. Tests of the WP interface with, say,
<http://www.openqa.org/selenium/>. Wasn't one of the summer of code
people was doing something like this?
It's less useful than it would be with complementary unit tests, but
still, better than nothing. The coverage could be deepened with unit
tests later on.
Anyway, good luck. I took up learning Haskell instead; it's much more
More information about the wp-hackers