There are different threads available for Unit Testing in WordPress. As far as concern, there should be a proper unit testing for every piece of customization done in WordPress.

I have checked couple of plugins and articles about the same. Here are the few.

  1. http://codex.wordpress.org/Theme_Unit_Test
  2. http://wptest.io/
  3. https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/

Now, with PHP unit we can write test cases as per our need. Test cases can be written for core functionalities and customization.

What about Automated Unit Testing for Theme with Heavy plugins and customization i.e. Mega Menu, Visual composer, Customization in Woo Commerce.

How this can be done? Any Standards for Unit Testing for site developed with premium theme and plugins with high level of customization ?

  • not sure what is the question here. unit testing is unit testing, why testing a code should somehow be different if it is used as a plugin? Commented May 23, 2016 at 8:49
  • 1
    We are trying to findout a standard way out for automated Unit Test that will work with any sort of development in Wordpress. No matter what? Commented May 23, 2016 at 9:13
  • standard for what? phpunit is the standard tool, but you know that. Each unit test is obviously different based on the requirements of the specific unit Commented May 23, 2016 at 9:28
  • Standard to write efficient code and website with quality. Commented May 23, 2016 at 9:46
  • Unit testing are used to discover regressions when code is changed, They don't actually have much of advantage in a "one off" site development that will not have much changes or when it will have a change it will be so major all the test will break. Unit test alone do not make your code better in any way, to make it better you need to use better software design practices. Commented May 23, 2016 at 9:53

1 Answer 1


I think that what you are looking for would actually technically be called functional testing, integration testing, or acceptance testing. It sounds like you want to test the behavior of the front-end of your website (or the front-end behavior of a plugin or theme), not each unit of the code itself. You might use a tool like PHPUnit to test your PHP code, and a tool like QUnit to test your JS code, but you will need a different tool to test the actual behavior of the website (or plugin/theme feature) as an integrated whole.

Unfortunately, acceptance testing is still rather young in the WordPress space. There are a few plugins or themes that do it, but there is no "core" method (but see trac ticket #34693). There isn't necessarily a consensus "best practice" tool that has emerged yet, either. So, as far as WordPress-specific tools, this is an area that is still being explored. (I myself am still just beginning to explore acceptance testing a WordPress plugin.)

However, there are many different tools out there for acceptance testing, they just haven't been built specifically with WordPress in mind. And that is OK. Because when you are testing the front-end behavior of a site, it really doesn't matter much what is powering the back-end. So a tool which can run tests on a scratch-built site will probably work very well for a WordPress site as well, or any other site.

Because WordPress is written in PHP, and tends to use PHPUnit for testing, Codeception is a natural choice for this. It is a framework that allows you to create unit tests (with PHPUnit), functional tests, and acceptance tests, which you can run with a single command. I think that perhaps this is just the kind of thing that you are looking for. If so, you will probably want to check out WP Browser as well, which is a set of WordPress-specific extensions for Codeception.

If there is an emerging go-to tool for acceptance testing WordPress plugins, I'd say that it might be Codeception. But to my knowledge, this is still a young thing among most WordPress developers, so we'll have to wait and see what happens in the future. Don't hesitate to jump in and start using it anyway though—maybe it will set a trend!

Update 2017-12-12

I've been using WP Browser for testing the WordPoints plugin, and I have been happy with it. I've also set up a repo demonstrating how to run WP Browser acceptance tests on Travis CI. There is still not a de facto standard in in the WordPress ecosystem, but Codeception + WP Browser remains one of the most prominent options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.