Every time we release new software here at Easy Digital Downloads we say firmly “Make sure you test this on a staging server before applying it to your live site”. Sean Davis went into great deal on why it’s very important to have a staging server. Sadly a high number of users don’t do this. The most common reason seems to be that people simply don’t know how to set one up, or believe that it’s a difficult or time consuming task.
In this post we’re going to talk about how to set up a testing server. Staging servers are intended to be permanent long term clones of your live site. Testing servers are intended to be stressed, broken, thrown away, and easily recreated for more testing.
I’m going to start right out by saying that the tool we’re going to use is DesktopServer Premium from ServerPress. It costs $99.95 at the time of this writing, but will prove to be invaluable.
Let’s get started.
Step 1: Get DesktopServer installed
DesktopServer is available for either Windows or OS X. For the purposes of this post you don’t need to set up a WordPress site or anything, simply get DesktopServer installed.
Step 2: Make a backup of your live site
DesktopServer can import backup files created by BackupBuddy, Duplicator, BackWP Up, BackUp WordPress, InfiniteWP & ManageWP. For this blog post we’re going to us Duplicator, but any of these will work just as well, and the instructions will be the same.
In Duplicator, click the Create New button:
Once you have a completed backup, download the Archive file for it.
Note: you do NOT need the Installer file for any of the backup options. Only the archive file.
Step 3: Import backup file into DesktopServer
In the desktop server app, choose the “Export, import, or share a website” option:
On the next page choose “Import an existing WordPress website archive”:
Lastly you’ll be asked to make up a domain name and load up your backup file:
After you hit Next DesktopServer will set up the local web site for you, and present you with a link to the domain name you made up. Below is a screenshot of Safari showing the site I made for this blog post:
Step 4: Configure for testing
At this point you have an exact copy of your live site. All the products, settings, images; everything is there.
Testing new features or updates on your new testing server requires no special configuration or settings, except for when testing payments. In order to safely test those you’ll want to configure your payment gateways for Test Mode.
In Downloads → Settings → Payment Gateways you’ll find the Test Mode switch right at the top:
Additionally you may wish to use a Sandbox for your payment gateway. We have documentation on how to set that up for both PayPal and Amazon Payments. Creating a Sandbox will really only need to be done once, and then you can use it for all of your tests in the future.
Also keep in mind that payment gateways that want to access your site probably won’t work with a local testing environment. Your local server isn’t accessable from the web.
Step 5: Test and test some more
At this point you’re ready to test your site. Upload new versions of plugins or themes and try your very hardest to break this new local site you’ve built. Ideally you’ll have a battery of standard tests you run on your site. If you don’t, now is a great time to make one. Simply keep notes of everything you test, and test the same things every time. Over time your list will grow as you find new things to test.
Make sure you read through the changelog for the software release you’re testing. Make sure you test each of the items that have been changed, added, or deleted. Testing your site is a science, and will take practice.
Bonus round
After you’ve gotten your local testing environment installed and configured for test mode, use your backup software (which should already be installed in your testing environment) to make a new backup and save it to your computer.
Then you can use DesktopServer to Remove your new testing server and make a new one. Except this time all your settings will be pre-configured for testing, and you can immediately start testing again. This is particularly useful when you’re running destructive tests like deleteing products, or running so many tests that resetting would be painful.
Summary
The process above can be summarized like this:
Backup your live site
Import it into DesktopServer
Configure for testing
Test it to death
Optionally repeat
If you’re already running regular backups on your site (which you should be) then step one is fairly moot. You simply grab the latest and import it.
One last thing that’s important to note, this process is NOT specific to Easy Digital Downloads. You should go through this process with every change that could break your site. When there’s a new version of WordPress coming out, make a testing server and try the betas. Your designer has a new theme you should try out? Make a testing server.
Once you get comfortable with it, making a testing server really only takes minutes, and there’s no excuse for not using it.