Skip to content Unit Testing
- Karen NA Gupta. Unit Testing WordPress Plugins with PHPUnit. wpmudev, 2017.
- Camden Segal. Unit Testing Your Plugins. webdevstudios, 2014.
- David Hayes. How to Start Unit Testing WordPress Plugins. wpshout, 2018.
- Collins Agbonghama. An Introduction to Automated Testing of WordPress Plugins with PHPUnit. smashing magazine, 2017.
- Good introductory article, includes directions on writing a small plugin, creating tests, and using phpunit.
- Pippin Williamson. Unit Tests for WordPress Plugins Series. 2014-2015.
- 2. Setting Up Our Testing Suite – Defines “testing suite”, installing PHPUnit and WP-CLI, how to use WP-CLI to setup unit tests, defines “tests” and “assertions”.
- 3. Writing Tests – Why/how to segment tests across multiple files, demonstrates writing several different tests.
- 4. The Factory – Discusses using WP_UnitTest_Factory to create sample data. Particularly demonstrates how to create a sample post / many sample posts / a sample user, creating a custom factory class.
- Carl Alexander.
- Introduction to WordPress Unit Testing. 2015.
- Explains the why of unit testing, discusses requirements including OS, PHP versions, Composer, PHPUnit, and WP-CLI. It also discusses PHP-Mock, test doubles, using a prefix helper function, and assertions.
- How Do You Start Unit Testing Existing WordPress Code? 2019.
- More high level, conceptual. Discusses code complexity, refactoring, unit testing, code reviews, and code coverage tools.
- Zack Grossbart. Writing Unit Tests for WordPress Plugins. smashing magazine, 2012.
- Tom McFarlin. The Beginner’s Guide to Unit Testing: What is Unit Testing? tutsplus, 2012.
- Tom McFarlin. Writing Unit Tests with PHPUnit. 2018.
- Tom McFarlin.
- Giuseppe Mazzapica. PHP Unit Tests without WordPress Loading. inpsyde, 2017.
- WordPress Plugin Unit Test with BrainMonkey and PHPUnit. swas.io, 2018.
- Cal Evans. Unit Testing WordPress Plugins. pantheon, 2014.
- David Aguilera. Introduction to Unit Testing in WordPress – PHPUnit. nelio, 2016.
- Will Haynes. Unit Testing Themes and Plugins in WordPress. inn labs, 2014.
- Thorsten Frommen. An Introduction to Unit Testing (for WordPress). 2017.
- Adding Unit Tests to a WordPress Plugin via VVV and PHPUnit. tilcode, 2019.
- Codeception for WordPress.*
- Unit-Testing with Mocks in WordPress. yoast, 2019.
- Jonathan Bossenger. Unit Tests for Your WordPress Plugin Using WP CLI and PHPUnit. 2019.
- Lee Blue. Unit Testing WordPress Plugins.
Usability
Other
Sandboxing
- WP Safe Updates – In cases where a host doesn’t offer a staging environment, WP Safe Updates create a sandbox environment so that plugins can be tested before upgrading.
Visual
Cross-Browser Compatibility
Tooling
Like this:
Like Loading...