Welcome to my blog series on the creation of a simple WordPress plug and the setup, configuration and process of running unit and integration tests on this plugin. I hope you find reading it as useful as I did writing it.
This series started with the first article as a stand-alone piece. As my list of WordPress development projects grew it became apparent to me that the addition of code testing was necessary to ensure the proper operation and quality of the code I was writing. People depend on that code. Lots of people.
As I undertook the tasks of adding user and integration testing to my process I mostly found two types of resources on the internet. First, program and package documentation. Great for answering ‘what’ but often a little thin on ‘why’ and ‘how’, especially since most of the testing tools are meant to run in a self chosen and assembled suite. Second, great articles on one slice of the testing process.
So I wrote the other eleven blog posts for two reasons: first, it greatly helped to organize my thoughts and reinforce and buttress my development process; second, I thought that other people who were looking to get into testing their WordPress stuff might find a basic, but comprehensive, examination of these topics useful. I include some cul-de-sacs I needed to back out of in favour of different approaches along with some mistakes I made along the way. This is the nature of development and I thought it more authentic to include some of these. (I didn’t include them all though. I make tons of mistakes and it would have been very fractured reading if I included them all.)
I examine the plugin and test code in some detail in the posts and include full code lists for most files. I have also tucked the final code in a github repo: https://github.com/twelch555/truucde-blog. Feel free to clone it if you want to follow along or adapt it for your own use.
Enjoy,
Troy Welch