I got a call from a client running a big membership site. We’d just pushed what we thought was a minor update, just a new field on the registration form. We tested it, the new field worked, the client was happy, and we deployed. An hour later the support tickets started pouring in. Existing members couldn’t log in. Total nightmare.
It turned out our new form validation script was mistakenly being loaded on the login page, throwing a JavaScript error that broke the login button. The PHP code was fine. The feature worked in isolation. But the user flow was completely broken. This is the exact kind of mess that WordPress acceptance testing is designed to prevent.
Unit tests vs. acceptance tests: what’s the difference?
Most WordPress devs, if they test at all, write unit tests. Unit tests are for us, the developers. They check whether a specific function does its job, for example whether get_user_role() returns ‘subscriber’. That’s useful, but it would have handed us a green light during the login disaster.
Acceptance testing is different. It doesn’t care about the code, it cares about the user’s journey. It drives a real web browser the way a person would. Can someone visit the login page, enter their details, click the “Log In” button, and land on their dashboard? It checks the whole process from the user’s side, not just whether the code runs.
My first thought after that incident was to add “Manually test the login page” to our pre-launch spreadsheet. We did, for a while. But that’s a band-aid, not a fix. People forget, especially once a project gets big. You need an automated safety net.
A practical example with Codeception
There are a few frameworks for this, but I lean toward Codeception for WordPress projects. It’s written in PHP, which we’re all using anyway, so the learning curve is much gentler. You don’t have to pick up a whole new language like Gherkin, the way you would with Behat. Carl Alexander wrote a good piece on the differences if you want to read more.
Writing a test for that login failure is dead simple. You create a test file and write something like this:
<?php
class LoginCest
{
public function _before(AcceptanceTester $I)
{
// ... setup steps if needed
}
public function ensureThatLoginWorks(AcceptanceTester $I)
{
$I->amOnPage('/login/');
$I->see('Log In');
$I->fillField('log', 'testuser');
$I->fillField('pwd', 'password123');
$I->click('wp-submit');
$I->see('Dashboard');
$I->see('Welcome, testuser');
}
}The test behaves like a user. It opens the login page, fills in the fields, clicks the button, and checks for the word “Dashboard.” With that JavaScript error in place, the test would have failed straight away. That was the end of the manual spreadsheet.
So, what’s the point?
WordPress acceptance testing isn’t extra process for its own sake. It changes how you protect your projects and your reputation by catching human error before your clients or customers run into it.
- It builds trust with clients because things just work.
- It saves you from stressful, post-launch hotfixes.
- It gives you the confidence to deploy changes without worrying you broke something unrelated.
This stuff gets complicated fast. If you’re tired of debugging someone else’s mess and you just want your site to work, drop my team a line. We’ve probably seen it before.
Manual checklists will let something slip eventually. Write tests that confirm your application actually works for the people using it. It will save you a world of pain.