10 Top Tools for Setting Up a Testing/Staging Environment for WordPress

10 Top Tools for Setting Up a Testing/Staging Environment for WordPress

In recent posts, I’ve written about creating a staging site on cheap hosting and shown you how to keep that staging site synced with your live site. But what if you want to investigate all the possible approaches to creating a suitable testing and/or staging environment?

Creating a duplicate site on your cheap hosting account is one way to do this, but it isn’t the only way. Whether you’re looking for a safe environment to do your development, or a reliable environment for testing (or maybe both), there are alternative ways of doing it, which vary in cost and complexity.

So let’s take a look at the top 10 ways you can set up up a development or staging environment for your WordPress site.

  • WP_DEBUG

    WP_DEBUG is an essential WordPress command for anyone testing their code. By default, it’s set to false in your wp-config.php file.

    When testing your code (and only in a testing environment you don’t want the error messages it throws up appearing on a live site), set it to true instead, and you’ll be provided with an error message every time you miss out a semicolon in your code, or worse.

    Once you’ve finished testing, set it back to false, just in case. Yu shouldn’t be copying your wp-config.php file between your testing and live sites but it doesn’t hurt to be safe.

    No more white screen of death, I can get behind that.

    Interested in WP_DEBUG?

  • Theme Unit Test Data

    The WordPress Theme Review team provides a set of comprehensive data designed for testing WordPress themes before they’re submitted to the WordPress theme repository. But they’re useful for anyone developing themes.

    Import this data into your development site and it will insert posts, pages, categories, tags, media and more in all the permutations you could think of, which helps you test that your theme displays all content types, and all formatting, correctly.

    If you’re submitting a theme to the wordpress.org theme repository, you should never do so without testing it with this data, and if you’re creating a theme for a site that clients or others will add data to, it makes sense to do comprehensive testing with any kind of data your client could throw at it.

    Interested in Theme Unit Test Data?

  • MAMP

    If you’re setting up a local development environment, MAMP is the single most useful tool you can have in your belt.

    MAMP stands for My Apache – MySQL – PHP. It lets you run a database-driven website on your local machine, something you can’t do without a tool like MAMP. The free version has all the features you need to install and run WordPress locally and lets thousands of web developers work locally, whether that’s to provide a secure development environment or to work when you’re offline.

    It used to be that MAMP was just for Mac, but it now works on Windows machines too, making it even more useful.

    Interested in MAMP?

  • XAMPP

    If you’re running Linux, MAMP won’t work for you, so you’ll need to install XAMPP instead. Like MAMP it’s free, and lets you run Apache, MySQL and PHP, meaning you can install WordPress locally.

    XAMPP is open source which means it’s a great alternative for people who prefer to use open source software, as it works not just on Linux, but on Windows and Mac too.

    Interested in XAMPP?

  • Vagrant

    If you want to keep your development, staging and live sites in sync (and you really should), then Vagrant will help you do this.

    Vagrant creates a virtualized WordPress environment which is easy to reproduce across platforms. The most popular way to use it is with VVV (Varying Vagrant Vagrants – I know!) which is an open source Vagrant configuration tailored for WordPress development. It lets you create multiple WordPress sites and includes tools for debugging, plugin creation and more. Find out how to set it up with our guide.

    It’s not as straightforward to use as some of the systems listed here – it uses the command line rather than a graphical interface – but once you’ve got to grips with it, it will make your workflow smoother and more professional. Hard-core developers swear by it.

    Interested in Vagrant?

  • Trellis

    Trellis combines the role of MAMP or XAMPP with Vagrant, giving you everything you need to create an easily duplicated local WordPress environment in one place.

    Use it to create your local development environment, hook up to your staging and live sites, and then deploy your code with a single command.

    You’ll need to install Vagrant, along with Ansible, VirtualBox and vagrant-hostmanager, before you can install Trellis, but once you’ve got everything in place it should bring all of your work into one place and make life easier.

    Interested in Trellis?

  • WP-CLI

    WP-CLI stands for WordPress Command Line Interface. It lets you perform a variety of tasks in your WordPress installation via the command line instead of via the admin screens or your hosting provider’s admin system.

    Using WP-CLI to carry out tasks such as backing up, migrating data, installing WordPress and much more is much quicker than many other tools. Again you’ll need to spend a bit of time learning how to use it and what commands are available to you, but comprehensive documentation is provided on the WP-CLI website.

    You don’t install it in the same way as you would an app or plugin, but via the command line, by using the wp package install command.

    Interested in WP-CLI?

  • GitHub

    The most thorough way to keep the code in your development, testing and live environments in sync is to use version control software, of which GitHub is by far the most popular.

    Create a GitHub repository (or repo) containing the files for your local development site, then commit your changes to that repo while you’re testing. Once you’re done making changes, sync the repo with your GitHub account which will store everything you did in a way that makes it easy for you to roll back your changes or to fork existing code in order to test changes or try out new versions of it.

    You can then use a deployment tool to deploy your code changes directly to your staging and/or live sites without having to manually copy any of the code. This means that if something goes wrong, you can roll back your changes on your live and staging sites as well as your local development site.

    GitHub is also great if you’re collaborating, as you can share repositories and work on them as a team, with coding tasks allocated to each user in the team.

    You can use GitHub via the command line or download an application to work with it locally using a graphical interface.

    Interested in GitHub?

  • DeployHQ

    Once you’ve got your code stored in a GitHub repo, you’ll need a tool to deploy it to your staging and live sites.

    My favourite deployment tool is DeployHQ. It makes the process of deploying your code quick and easy, it lets you roll back your deployments if you encounter a problem, and it’s free for one site or if your project is open source.

    You access the tool via the DeployHQ website where you provide details of your GitHub repo and your server, and once that’s done, it does the rest for you quickly and easily. It’s way more reliable than manually uploading files via FTP.

    Interested in DeployHQ?

  • Snapshot Pro

    Our own Snapshot Pro plugin is designed to help you back up your site – and crucially, restore it – quickly and easily. But it can also be used when you need to migrate your site or keep it in sync with your testing or staging site.

    This method isn’t what an advanced WordPress developer would do – the tools above are considered more professional – but if you’re wary of the command line and prefer to use plugins, then Snapshot Pro can help you with your testing process.

    Interested in Snapshot Pro?

Wrapping Up

So those are my top 10 recommended tools for creating an efficient development and testing environment for WordPress. There are dozens of tools out there that you can use to help with your development, and this is just a snapshot of some of my favorites.

Good luck with your development environment and happy testing!

What's your favourite tool for testing and development with WordPress? Tell us in the comments below.