For about 5 years, WordPress was my primary platform and having been bit by the TDD bug by other frameworks and communities, I was very keen on applying Automated Testing to my programming practice, even in WordPress. I had some pretty good success with unit testing PHP classes I wrote for use in plugins but didn’t go too much deeper with it. I knew that there were some unit tests for WP core floating around out there, but it was my understanding that they were kind of languishing in obscurity. Well, that changed recently and I was so excited by the news that I applied to speak about it at WordCamp Chicago, which I did this past weekend.
After hanging out with the community on Saturday and getting temperature checks from attendees, I realized I needed to take a different approach. Instead of the planned TDD lecture, I opted to do an interactive code session and showed people how to install PHPUnit and explore the WordPress Test Suite. If you missed it, you can follow my session notes to get the WordPress Unit Tests up and running on your machine.
The session seemed to be well received, as it generated pretty good responses from the audience. I was able to weave in some of the themes from the software craftsmanship movement that I feel are underrepresented in the PHP community, which I’ve done before.
I also touched on the plugin quality discussion that’s been going on in the WP community of late and how I felt testing and social coding features could help improve that.
“It seems like we sort of distrust each other’s code when we could be improving it.” – @xentek at #wcchi
— Deanna Ogle (@deannaogle) August 26, 2012
And while I’m thrilled at the response, this is just the beginning. There is still a long way to go before we’ll be downloading plugins from dotorg with full test suites. It is my hope that in small part talks like mine will inspire others to dig deeper into TDD and start to practice it in their WordPress projects.