{"id":163656,"date":"2017-04-19T13:00:53","date_gmt":"2017-04-19T13:00:53","guid":{"rendered":"https:\/\/premium.wpmudev.org\/blog\/?p=163656"},"modified":"2017-04-18T05:36:04","modified_gmt":"2017-04-18T05:36:04","slug":"testing-staging-environment-tools","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/testing-staging-environment-tools\/","title":{"rendered":"10 Top Tools for Setting Up a Testing\/Staging Environment for WordPress"},"content":{"rendered":"<p>In recent posts, I&#8217;ve written about <a href=\"https:\/\/wpmudev.com\/blog\/set-up-staging-site-cheap-shared-hosting\/\" target=\"_blank\">creating a staging site on cheap hosting<\/a> and shown you <a href=\"https:\/\/wpmudev.com\/blog\/sync-staging-live-sites-wordpress\/\" target=\"_blank\">how to keep that staging site synced with your live site<\/a>. But what if you want to investigate\u00a0all the possible approaches to creating a suitable testing and\/or staging environment?<\/p>\n<p>Creating a duplicate site on your cheap hosting account is one way to do this, but it isn&#8217;t the only way. Whether you&#8217;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.<\/p>\n<p>So let&#8217;s take a look at the top 10 ways you can set up up a development or staging environment for your WordPress site.<\/p>\n<ul class=\"dev-tutorial-list\"><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">WP_DEBUG<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/wp-debug-1-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"WP_DEBUG image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>WP_DEBUG is an essential WordPress command for anyone testing their code. By default, it&#8217;s set to <strong>false<\/strong> in your wp-config.php file.<\/p>\n<p>When testing your code (and <strong>only<\/strong> in a testing environment you don&#8217;t want the error messages it throws up appearing on a live site), set it to <strong>true<\/strong> instead, and you&#8217;ll be provided with an error message every time you miss out a semicolon in your code, or worse.<\/p>\n<p>Once you&#8217;ve finished testing, set it back to false, just in case. Yu shouldn&#8217;t be copying your <em>wp-config.php<\/em> file between your testing and live sites but it doesn&#8217;t hurt to be safe.<\/p>\n<p>No more white screen of death, I can get behind that.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in WP_DEBUG?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/codex.wordpress.org\/WP_DEBUG\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Theme Unit Test Data<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/theme-unit-test-data-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Theme Unit Test Data image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>The WordPress Theme Review team provides a set of comprehensive data designed for testing WordPress themes before they&#8217;re submitted to the WordPress theme repository. But they&#8217;re useful for anyone developing themes.<\/p>\n<p>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.<\/p>\n<p>If you&#8217;re submitting a theme to the wordpress.org theme repository, you should never do so without testing it with this data, and if you&#8217;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.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Theme Unit Test Data?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/codex.wordpress.org\/Theme_Unit_Test\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">MAMP<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/mamp-pro-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"MAMP image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>If you&#8217;re setting up a local development environment, MAMP is the single most useful tool you can have in your belt.<\/p>\n<p>MAMP stands for My Apache \u2013 MySQL \u2013 PHP. It lets you run a database-driven website on your local machine, something you can&#8217;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&#8217;s to provide a secure development environment or to work when you&#8217;re offline.<\/p>\n<p>It used to be that MAMP\u00a0was just for Mac, but it now works on Windows machines too, making it even more useful.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in MAMP?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/www.mamp.info\/en\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">XAMPP<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/xampp-600x300.jpg\" class=\"attachment-ratio-large size-ratio-large\" alt=\"XAMPP image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>If you&#8217;re running Linux, MAMP won&#8217;t work for you, so you&#8217;ll need to install XAMPP instead. Like MAMP it&#8217;s free, and lets you run Apache, MySQL and PHP, meaning you can install WordPress locally.<\/p>\n<p>XAMPP is open source which means it&#8217;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.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in XAMPP?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/www.apachefriends.org\/index.html\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Vagrant<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/vagrant-1-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Vagrant image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>If you want to keep your development, staging and live sites in sync (and you really should), then Vagrant will help you do this.<\/p>\n<p>Vagrant creates a virtualized\u00a0WordPress environment which is easy to reproduce across platforms. The most popular way to use it is with VVV (Varying Vagrant Vagrants &#8211; I know!) which is an open source Vagrant configuration tailored for\u00a0WordPress 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 <a href=\"https:\/\/wpmudev.com\/blog\/vvv-wordpress-development\/\" target=\"_blank\">our guide<\/a>.<\/p>\n<p>It&#8217;s not as straightforward to use as some of the systems listed here \u2013 it uses the command line rather than a graphical interface \u2013 but once you&#8217;ve got to grips with it, it will make your workflow smoother and more professional. Hard-core developers\u00a0swear by it.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Vagrant?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/www.vagrantup.com\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Trellis<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/trellis-1-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Trellis image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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.<\/p>\n<p>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.<\/p>\n<p>You&#8217;ll need to install Vagrant, along with Ansible, VirtualBox and vagrant-hostmanager,\u00a0before you can install Trellis, but once you&#8217;ve got everything in place it should bring all of your work into one place and make life easier.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Trellis?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/roots.io\/trellis\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">WP-CLI<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/wp-cli-1-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"WP-CLI image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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&#8217;s admin system.<\/p>\n<p>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&#8217;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.<\/p>\n<p>You don&#8217;t install it in the same way as you would an app or plugin, but via the command line, by using the <em>wp package install<\/em> command.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in WP-CLI?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"http:\/\/wp-cli.org\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">GitHub<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/github-1-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"GitHub image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>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.<\/p>\n<p>Create a GitHub repository (or repo) containing the files for your local development site, then commit your changes to that repo while you&#8217;re testing. Once you&#8217;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.<\/p>\n<p>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.<\/p>\n<p>GitHub is also great if you&#8217;re collaborating, as you can share repositories and work on them as a team, with coding tasks allocated to each user in the team.<\/p>\n<p>You can use GitHub via the command line or download an application to work with it locally using a graphical interface.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in GitHub?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/github.com\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">DeployHQ<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/deploy-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"DeployHQ image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>Once you&#8217;ve got your code stored in a GitHub repo, you&#8217;ll need a tool to deploy it to your staging and live sites.<\/p>\n<p>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&#8217;s free for one site or if your project is open source.<\/p>\n<p>You access the tool via the DeployHQ website where you provide details of your GitHub repo and your server, and once that&#8217;s done, it does the rest for you quickly and easily. It&#8217;s way more reliable than manually uploading files via FTP.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in DeployHQ?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/www.deployhq.com\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><li class=\"dev-tutorial-list__item\"><header class=\"dev-tutorial-list__item__header\"><h3 class=\"dev-tutorial-list__item__title\">Snapshot Pro<\/h3><\/header><section class=\"dev-tutorial-list__item__image\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"300\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2017\/03\/snapshot-pro-3-600x300.png\" class=\"attachment-ratio-large size-ratio-large\" alt=\"Snapshot Pro image\" aria-hidden=\"true\" \/><\/section><!-- end dev-tutorial-list__item__image --><section class=\"dev-tutorial-list__item__content\"><p>Our own Snapshot Pro plugin is designed to help you <a href=\"https:\/\/wpmudev.com\/blog\/backup-with-snapshot\/\" target=\"_blank\">back up your site<\/a> \u2013 and crucially, restore it \u2013 quickly and easily. But it can also be used when you need to <a href=\"https:\/\/wpmudev.com\/blog\/easy-migration-snapshot\/\" target=\"_blank\">migrate your site<\/a> or keep it in <a href=\"https:\/\/wpmudev.com\/blog\/sync-staging-live-sites-wordpress\/\" target=\"_blank\">sync with your testing or staging site<\/a>.<\/p>\n<p>This method isn&#8217;t what an advanced WordPress developer would do \u2013 the tools above are considered more professional \u2013 but if you&#8217;re wary of the command line and prefer to use plugins, then Snapshot Pro can help you with your testing process.<\/p>\n<\/section><!-- end dev-tutorial-list__item__content --><footer class=\"dev-tutorial-list__item__footer\"><p>Interested in Snapshot Pro?<\/p><div class=\"dev-tutorial-list__item__cta\"><a target=\"_blank\" href=\"https:\/\/wpmudev.com\/project\/snapshot\/\" class=\"dui-btn dui-btn--sm dui-btn--brand dev-btn--Details\">Details<\/a><\/div><!-- end dev-tutorial-list__item__cta --><\/footer><!-- end dev-tutorial-list__item__footer --><\/li><!-- end dev-tutorial-list__item --><\/ul><!-- end dev-tutorial-list -->\n<h2>Wrapping Up<\/h2>\n<p>So those are my top 10 recommended tools for creating an efficient\u00a0development 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.<\/p>\n<p>Good luck with your development environment and happy testing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In recent posts, I&#8217;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\u00a0all the possible approaches to creating a suitable testing and\/or staging environment? Creating a duplicate site on your cheap hosting account is [&hellip;]<\/p>\n","protected":false},"author":347011,"featured_media":164202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[557],"tags":[9770,10653,10789],"tutorials_categories":[],"class_list":["post-163656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-development-2","tag-staging-environment","tag-testing-environment"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/163656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/347011"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=163656"}],"version-history":[{"count":6,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/163656\/revisions"}],"predecessor-version":[{"id":164201,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/163656\/revisions\/164201"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/164202"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=163656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=163656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=163656"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=163656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}