One of the reasons so few people take the time to write unit tests for plugins they author is that it’s a chore to set everything up. Besides installing PHPUnit, you also have to set up the WordPress testing library, as well as the actual plugin tests configuration files.

If you’re running WP-CLI 0.9.0-alpha2 or later, there are commands that make the last two steps significantly easier. See the Plugin Unit Tests wiki page for up-to-date usage info.

You can check out the sample-plugin repo to see what a generated plugin looks like.

A shout-out to the people that contributed to benbalter/wordpress-plugin-tests is in order.