How to Run Automated Tests on Your WordPress Blog
October 13th, 2007
We usually set up a WordPress website within an offline development environment and migrate it to the target webspace when it is finished. We are used to test everything thoroughly, but…
How do you quickly check if everything is allright, before you go “online”?
How can you check for potential compatibility errors after upgrading WordPress and/or plugins?
The answer is: Run automated HTML Unit Tests.
According to the rules of extreme programming, test-driven development the idea of unit tests is to always write the test before the actual functionality. For this post, I will sum up in 3 easy steps, how to adopt that concept for running automated checks on your blog without any programming!
Step 1
Most people use Firefox and Firebug as essential tools for webdevelopment. You are going to add one more great extension called Selenium-IDE. So these are you prerequisites:
Step 2
Define some important functionality that should never break. For the purpose of this tutorial, we just check the search function of your blog:
- Open you blog’s home page in Firefox
- Start Selenium-IDE from Firefox’ extras menu. It will be in record mode by default.
- Search any term on your blog.
- Click the Selenium-IDE record button to stop recording your html unit test.
Step 3
Not hit the play button in Selenium-IDE, lean back and watch! I run these tests preferably with Firebug open. That way I can see whats going on.
That’s it! Now play around with Selenium and you’ll discover very quickly hundreds of situations where this tool will come in handy.
Notes
A few more hints what can be done with Selenium-IDE:
Need to run variations of one test?
Copy and paste the test commands within the table tab of Selenium-IDE. You can edit these commands and run the same test in different variations.
Need the same test for different blogs/installations?
Save generic tests changing the Base URL for more WordPress installations to check. I need to do this,to be able to run the same HTML Unit Tests at my production site that are running within my offline development environment.
Want to check User-level functionality?
Create a User on your blog just for the test environment. With Selenium-IDE you can record the whole process from logging in, posting content, editing content until logout.
Share ThisPosted by Roland Rust
File under: Wordpress Plugins
Leave a Reply
See also:
- Find Us in dutch language (January 13th, 2008)
- Plugins in action: Mini-Slides (November 19th, 2007)
- Demo Mode 1.2 released (November 18th, 2007)
- Plugins in action: Mini-Slides on timbuktoons.tv (November 17th, 2007)
- Demo Mode 1.1 released (November 9th, 2007)


October 30th, 2007 at 11:38 am
Selenium Test Runner is more useful than Selenium IDE for Functional Testing