Unit testing is an important part of verifying that code works as expected. However, how many tests do you need to write before you can be confident that you’ve done a good job? Where should you be spending your time writing tests, and how do you know when you’re done?
In this talk, we discuss a systematic approach to unit testing WordPress plugins using phpunit. We show how to set up a simple test suite, to examine the code coverage options, and to identify the most risky areas of our code that are in need of tests.
Learning Outcomes
- Build a scaffold for unit testing WordPress plugins
- Write meaningful unit tests for WordPress plugins using phpunit
- Use completeness coverage to show how well a test suite covers a plugin’s functionality
- Show how code coverage exposes potentially dangerous areas
- Encourage everyone to write unit tests, because they’re great and cool. 🙂