Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Unit Testing and WordPress Plugins
jbl.me/wcphilly
What is Unit Testing?
Unit testing is the method by which programmers ensure each individual component of our application is functioning correctly and as expected.
In other words, make sure your code works
So what's the big deal?
The Unit
A unit is the smallest testable block of code in your program.
Scripted and Automated
Unit tests follow a pre-defined routine and are usually automated.
Benefits of Unit Testing
- Efficient debugging
- Encourages good coding practices
- Makes your code more portable
- Helps prevent regressions
Most Importantly...
Unit testing is a tool, not a solution.
What Should You Unit Test?
- Any code that could break
- Libraries, frameworks, modules, etc.
- Code with multiple authors
- Portable code
What Should You Not Test
- UI and UX design
- Prototypes
- 3rd party code integration
Unit Testing Workflows
- Tests first
- Bug reports
- Continuous integration
- Just do it
Tools for WordPress Testing
- WordPress Unit Testing Framework
(unit-tests.trac.wordpress.org)
- PHPUnit
(phpunit.de)
- WordPress Plugin Tests by Ben Balter
(github.com/benbalter/wordpress-plugin-tests)