|Download This Plugin|
|Download Elegant Themes|
|Name||SimpleTest for WordPress|
|Last updated||2014-07-30 10:25:00|
|Download Plugins Speed Test plugin for Wordpress|
Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%
SimpleTest for WordPress plugin added 12 bytes of resources to the Home page and 17 bytes of resources to the sample Post page.
SimpleTest for WordPress plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.Great! SimpleTest for WordPress plugin ads no tables to your Wordpress blog database.
I am currently no longer developing or supporting this plugin. I may resume development and support in the future, but I'm not sure when.
SimpleTest for WordPress is a tool for WordPress plugin developers who want to create and run automated tests for their plugins. It includes SimpleTest 1.1 and uses a shortcode to let you run unit tests on WordPress plugins, and see the results in a WordPress page. Since it runs within WordPress, you can also do integration testing of plugins (that is, custom WordPress functions used in the plugins will work correctly when the tests are run).
Installation of Toppa Plugin Libraries for WordPress is required for this plugin. Please download and install it first.
The "tests" subdirectory contains real, example unit and integration tests so you can see how tests are written for SimpleTest (it is very similar to PHPUnit, but I find its use of mock objects more straightforward, and since SimpleTest's native output is HTML, it integrates nicely with WordPress).
Usage is simple. Create a page or post where you want to display test results (you'll probably want to make this a private page). Then add a shortcode like this:
[simpletest name="SimpleTest Unit Tests" path="/simpletest-for-wordpress/tests/UnitWpSimpleTest.php" passes="y"]
A css file is included for styling the test output results. Copy the css file to your active theme folder and customize to your heart's content.
Applying Agile Coding Practices to WordPress Plugin Development
The example shortcode above will work. It runs the unit tests I wrote for the plugin itself. I also included integration tests. Test coverage is limited however, given inherent limitations of testing the test harness itself. The differences between the unit tests and integration tests are that the unit tests use mock versions of the plugin's external dependencies (on WordPress functions and the filesystem), and the integration tests run against the actual dependencies. The former tell you if your plugin's internal logic is correct, the latter tell you if there are any problems interfacing with external dependencies. Don't write dirty hybrids that mix the two! Then it's hard to even tell what you're really testing.