{"id":21692,"date":"2018-05-21T12:15:23","date_gmt":"2018-05-21T09:15:23","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=21692"},"modified":"2018-05-18T11:09:46","modified_gmt":"2018-05-18T08:09:46","slug":"7-ways-to-improve-your-test-suite-with-docker","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/","title":{"rendered":"7 Ways to Improve Your Test Suite with Docker"},"content":{"rendered":"<p>I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying unusual server configurations, and seeding complex data make testing large applications tough. While plenty of solutions exist, I have found myself leaning on Docker more and more in the past year.<\/p>\n<h2>Why Docker for Testing?<\/h2>\n<p>If you aren\u2019t familiar with Docker, <a href=\"https:\/\/blog.codeship.com\/why-docker\/\">Barry Jones has written a great primer for Codeship\u2019s blog<\/a>. At a high level, Docker makes it faster and easier to spin up services using a variety of configurations. This translates into a number of advantages when running your tests in Docker:<\/p>\n<ul>\n<li><strong>You can keep server configuration in code.<\/strong> Any developer or CI environment will run the exact same setup.<\/li>\n<li><strong>It takes just a few seconds to set up or tear down an environment in Docker.<\/strong> You can quickly test your code with multiple versions of the language or run integration tests with different combinations of supporting services.<\/li>\n<li><strong>Docker works great with continuous integration tools.<\/strong> This allows you to run your CI more often and catch catch issues faster.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blog.codeship.com\/testing-with-docker\/\">Manuel Weiss covers some other great reasons that Docker makes testing more efficient here<\/a>, but in the remainder of this article, I\u2019ll focus on specific examples of how you can use Docker to improve your test suite. These examples are available in more detail <a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\">on GitHub<\/a>, so feel free to clone the repository if you want to follow along.<\/p>\n<h2>1: Working with Older Versions of the Language<\/h2>\n<p>Last year, I spent some time working with <a href=\"https:\/\/github.com\/mevdschee\/php-crud-api\">Maurits van der Schee\u2019s \u201cphp-crud-api\u201d<\/a>, an open-source PHP project that creates a <a href=\"https:\/\/restfulapi.net\/\">RESTful API<\/a> from an existing relational database. The project officially supports PHP 5.3 through 7.1 in combination with Postgres 9.1+, MySQL 5.5+, MS SQL Server 2012+, and SQLite 3, which means there are dozens of combinations of PHP and databases to potentially support.<\/p>\n<p>If you\u2019ve ever maintained an open-source package, you know how tough it can be to prevent breaking changes in older versions of the language. Docker makes this easier as you no longer have to set up and run multiple virtual machines to verify your application works. For example, let\u2019s say you have a PHP function that will sort an array of objects:<\/p>\n<pre class=\"brush:php\">&lt; ?php\r\n\r\nfunction sortArrayOfObjects(string $field, array $objects): array\r\n{\r\n    usort($objects, function ($a, $b) use ($field) {\r\n        return $a-&gt;{$field} &lt; =&gt; $b-&gt;{$field};\r\n    });\r\n\r\n    return $objects;\r\n}<\/pre>\n<p>This function uses some of the newest features from PHP 7, including <a href=\"http:\/\/php.net\/manual\/en\/migration70.new-features.php#migration70.new-features.scalar-type-declarations\">scalar type hinting<\/a>, <a href=\"http:\/\/php.net\/manual\/en\/functions.returning-values.php#functions.returning-values.type-declaration\">return type declarations<\/a>, and the <a href=\"http:\/\/php.net\/manual\/en\/migration70.new-features.php#migration70.new-features.spaceship-op\">\u201cspaceship\u201d operator<\/a>.<\/p>\n<p>In order to find out if this code will work with an older version of PHP, simply run the test (<a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/blob\/master\/ex-1\/index.php#L21\">see the test code here<\/a>) from within a Docker container:<\/p>\n<pre class=\"brush:php\"># Running in PHP 5.6 leads to a syntax error\r\n$ docker run --rm -v $(pwd):\/app -w \/app php:5.6 vendor\/bin\/phpunit index.php\r\n&gt; Parse error: syntax error, unexpected ':', expecting '{' in \/app\/index.php on line 12\r\n\r\n# Running in PHP 7.0 works\r\n$ docker run --rm -v $(pwd):\/app -w \/app php:7.0 vendor\/bin\/phpunit index.php\r\n\r\n&gt; PHPUnit 5.7.27 by Sebastian Bergmann and contributors.\r\n&gt; ...\r\n&gt; OK (1 test, 2 assertions)<\/pre>\n<blockquote><p>If you\u2019re not familiar with the Docker CLI or <code>run<\/code> command, check out <a href=\"https:\/\/docs.docker.com\/engine\/reference\/run\/\">the official documentation<\/a> or this short tutorial on <a href=\"https:\/\/www.shiphp.com\/blog\/2017\/php-script-in-docker\">running a PHP script in Docker<\/a>.<\/p><\/blockquote>\n<p>Now you have a simple way to verify that your tests will pass (or fail) in any version of PHP for which there is a <a href=\"https:\/\/hub.docker.com\/_\/php\/\">Docker Image<\/a>. Unlike setting up and running a virtual machine, running a Docker container takes just seconds once you\u2019ve downloaded the image.<\/p>\n<h2>2: Testing Required Extensions<\/h2>\n<p>Another common problem that developers run into is knowing how their code will run on a new server. Even if you know which version of the programming language is running, you may not have all of the same extensions available. For example, PHP does not necessarily include the <a href=\"http:\/\/php.net\/manual\/en\/book.mysqli.php\">MySQLi extension<\/a>, so if your app needs to connect to a MySQL database, this will be a big problem.<\/p>\n<p>Let\u2019s say you wrote a function that connects to your database and returns the version of MySQL:<\/p>\n<pre class=\"brush:php\">function getMysqlVersion(): string\r\n{\r\n    $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS);\r\n\r\n    if (mysqli_connect_errno()) {\r\n        throw new Exception(\"Connection failed: %s\\n\" . mysqli_connect_error());\r\n    }\r\n\r\n    $version = mysqli_get_server_version($link);\r\n\r\n    mysqli_close($link);\r\n\r\n    return $version;\r\n}<\/pre>\n<p>If you test this (see <a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/blob\/master\/ex-2\/index.php#L32\">test here<\/a>) in the default PHP 7.2 Docker image, it will fail:<\/p>\n<pre class=\"brush:php\">$ docker run --rm -v $(pwd):\/app -w \/app --link database php:7.2 vendor\/bin\/phpunit index.php\r\n&gt; Error: Call to undefined function mysqli_connect()<\/pre>\n<p>This tells you that the code requires an extension that PHP doesn\u2019t have by default, but you can include it if you build your own <a href=\"https:\/\/www.tutorialspoint.com\/docker\/docker_images.htm\">Docker Image<\/a>. To build a custom image, add a <a href=\"https:\/\/docs.docker.com\/engine\/reference\/builder\/\"><code>Dockerfile<\/code><\/a> to the project that adds the MySQLi extension:<\/p>\n<pre class=\"brush:sql\">FROM php:7.2\r\nRUN docker-php-ext-install mysqli<\/pre>\n<p>Then build a new image and run your test in the new image:<\/p>\n<pre class=\"brush:php\"># Build a custom Docker image from our Dockerfile\r\n$ docker build . -t php-72-mysqli\r\n\r\n# Run our test using the new image\r\n$ docker run --rm -v $(pwd):\/app -w \/app --link database php-72-mysqli vendor\/bin\/phpunit index.php<\/pre>\n<p>Now your tests will pass, and you can commit this Dockerfile to ensure that other developers know this extension is required. If all the developers on your team commit to local development in Docker, it greatly reduces the all-to-common \u201cworks on my machine\u201d excuse.<\/p>\n<h2>3: Integration Testing Different Services<\/h2>\n<p>Another challenge I ran into when testing <a href=\"https:\/\/github.com\/mevdschee\/php-crud-api\">PHP Crud API<\/a> was that it had to support four different databases and many versions of each. It would be nearly impossible to test every combination in virtual machines, but Docker makes spinning up and connecting to different databases very easy.<\/p>\n<p>For example, if you want to run your tests in MySQL 5.6 and 5.7, you can start two containers:<\/p>\n<pre class=\"brush:sql\"># Starts a MySQL 5.6 container\r\ndocker run --name mysql-56 --rm -d -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_DATABASE=test mysql:5.6\r\n\r\n# Starts a MySQL 5.7 container\r\ndocker run --name mysql-57 --rm -d -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_DATABASE=test mysql:5.7<\/pre>\n<p>The following PHP code creates a JSON column on your table (<a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/blob\/master\/ex-3\/index.php\">see the whole file on GitHub<\/a>):<\/p>\n<pre class=\"brush:php\">\/**\r\n * Creates a table with JSON fields, a feature only available in MySQL 5.7+.\r\n *\/\r\nfunction createTableWithJsonFields(): bool\r\n{\r\n    $link = getLink();\r\n    mysqli_select_db($link, DB_DATABASE);\r\n    $createTableQuery = 'CREATE TABLE IF NOT EXISTS '.DB_TABLE.' (id INT, json_field JSON);';\r\n    if (!$result = mysqli_query($link, $createTableQuery)) {\r\n        throw new Exception(\"Table could not be created.\");\r\n    }\r\n    mysqli_close($link);\r\n    return $result;\r\n}<\/pre>\n<p><a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/blob\/master\/ex-3\/index.php#L63\">The test for this code<\/a> makes sure the table was successfully created. Now you can run your tests against the MySQL 5.6 and MySQL 5.7 containers:<\/p>\n<pre class=\"brush:php\"># Connect to the MySQL 5.6 container and run tests\r\ndocker run --rm -v $(pwd):\/app -w \/app --link mysql-56 php-72-mysqli vendor\/bin\/phpunit index.php\r\n&gt; Exception: Table could not be created.\r\n\r\n# Connect to the MySQL 5.7 container and run tests\r\ndocker run --rm -v $(pwd):\/app -w \/app --link mysql-57 php-72-mysqli vendor\/bin\/phpunit index.php\r\n&gt; OK (1 test, 3 assertions)<\/pre>\n<p>This tells you that the application will run with a MySQL 5.7 database, but not 5.6, and that can save you a lot of time debugging. You can use this same strategy to verify that updating your web server or caching service won\u2019t break your core codebase.<\/p>\n<h2>4: Seeding Data with Volumes<\/h2>\n<p>While running multiple versions of your language and services may be helpful for open-source projects, you might not have to worry about those situations in your day-to-day work. That said, there are still plenty of cases where Docker can help your test suite. For example, what if you need to seed the same data in your database every time you run your tests?<\/p>\n<p>At <a href=\"https:\/\/www.thegraidenetwork.com\/\">The Graide Network<\/a>, we run a suite of microservices that can seed themselves independently, but when we want to run end-to-end tests, it\u2019s a little trickier. We use a SQL file mounted into our database container via a <a href=\"https:\/\/docs.docker.com\/storage\/\">Docker volume<\/a> to make sure that the database is set up the same every time we run our tests.<\/p>\n<p>For example, if you check some dummy data into your version control, you can make sure all developers use the same data to start their MySQL container:<\/p>\n<pre class=\"brush:php\">docker run --name database --rm -d -e MYSQL_ALLOW_EMPTY_PASSWORD=true -v $(pwd)\/data:\/var\/lib\/mysql mysql:5.7<\/pre>\n<p>The command above mounts the <code>.\/data<\/code> directory into <code>\/var\/lib\/mysql<\/code>, the folder that hosts MySQL\u2019s data files, so each time you start up this database, the same data will be present in the container.<\/p>\n<h2>5: Docker Compose for End-to-End Tests<\/h2>\n<p>Unit and integration tests might make up the bulk of your test suite, but <a href=\"https:\/\/medium.freecodecamp.org\/why-end-to-end-testing-is-important-for-your-team-cb7eb0ec1504\">end-to-end tests should also play an important role<\/a>. At The Graide Network, we run a few dozen microservices, which makes end-to-end testing especially challenging. Fortunately, <a href=\"https:\/\/docs.docker.com\/compose\/\">Docker Compose<\/a> has made testing our whole application much easier.<\/p>\n<p>While many options exist for running end-to-end tests, I like <a href=\"http:\/\/nightwatchjs.org\/\">Nightwatch.js<\/a>, a Node-powered browser testing tool. In order to run your end-to-end tests with Docker Compose and Nightwatch, you\u2019ll need to create a <code>docker-compose.yml<\/code> file in the root directory of your project:<\/p>\n<pre class=\"brush:php\">version: '3.5'\r\nservices:\r\n  nginx:\r\n    image: nginx:alpine\r\n    volumes:\r\n      - .\/app:\/usr\/share\/nginx\/html\r\n  chromedriver:\r\n    image: blueimp\/chromedriver\r\n    environment:\r\n      - VNC_ENABLED=true\r\n      - EXPOSE_X11=true\r\n    ports:\r\n      - 5900:5900\r\n  nightwatch:\r\n    image: blueimp\/nightwatch:0.9\r\n    depends_on:\r\n      - chromedriver\r\n      - nginx\r\n    environment:\r\n      - WAIT_FOR_HOSTS=nginx:80 chromedriver:4444 chromedriver:6060\r\n    volumes:\r\n      - .\/:\/home\/node<\/pre>\n<p>This Compose file starts three Docker containers: an NGINX server, a headless Chrome instance, and a Nightwatch test runner. Assuming your folders and <code>nightwatch.json<\/code> file are set up properly (check <a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/tree\/master\/ex-5\">the example to see how you should do it<\/a>), you can run your Nightwatch suite with one single Docker Compose command:<\/p>\n<pre class=\"brush:php\"># Run the nightwatch tests\r\ndocker-compose run nightwatch<\/pre>\n<h2>6: Spin Up Multiple Services<\/h2>\n<p>What if your test suite requires a more complicated set of apps? For example, a Node backend app with a single page Javascript and HTML frontend?<\/p>\n<p>Docker Compose <a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/tree\/master\/ex-6\">can handle this setup as well<\/a>. Containers in a Docker Compose file are automatically networked together, you can use this method to start a Node API and NGINX webserver for the frontend:<\/p>\n<pre class=\"brush:php\">version: '3.5'\r\nservices:\r\n  api:\r\n    build: .\r\n    volumes:\r\n      - .\/api:\/app\r\n  nginx:\r\n    image: nginx:alpine\r\n    volumes:\r\n      - .\/app:\/usr\/share\/nginx\/html\r\n  chromedriver:\r\n    image: blueimp\/chromedriver\r\n    environment:\r\n      - VNC_ENABLED=true\r\n      - EXPOSE_X11=true\r\n    ports:\r\n      - 5900:5900\r\n  nightwatch:\r\n    image: blueimp\/nightwatch:0.9\r\n    depends_on:\r\n      - chromedriver\r\n      - nginx\r\n      - api\r\n    environment:\r\n      - WAIT_FOR_HOSTS=nginx:80 chromedriver:4444 chromedriver:6060 api:3000\r\n    volumes:\r\n      - .\/:\/home\/node<\/pre>\n<p>When you run this set of containers using the same Docker Compose command we used before, they will automatically be linked and your frontend will be able to make API calls to the backend Node app using a DNS record that Docker sets. In the example above, this means your frontend will <a href=\"https:\/\/github.com\/karllhughes\/docker-testing-examples\/blob\/master\/ex-6\/app\/index.html\">call the backend like this<\/a>:<\/p>\n<pre class=\"brush:php\">fetch('http:\/\/api:3000\/')\r\n  .then(resp =&gt; resp.json())\r\n  .then(function(data) {\r\n    \/\/ Do something with the data\r\n  });<\/pre>\n<p>Docker Compose has some other great features for complex applications like <a href=\"https:\/\/docs.docker.com\/compose\/networking\/\">advanced networking options<\/a> and <a href=\"https:\/\/docs.docker.com\/compose\/extends\/\">extensible Compose files<\/a>, so be sure to <a href=\"https:\/\/docs.docker.com\/compose\/\">read the docs for more<\/a>.<\/p>\n<h2>7: Automate Your Continuous Integration<\/h2>\n<p>Finally, automation is one of the biggest advantages to running your test suite in Docker. One way to do this is with <a href=\"https:\/\/codeship.com\/features\/pro\">Codeship Pro<\/a>, which uses Docker to run your application and test suite. Once you build a Docker Compose file that works locally, you can copy and tweak that file to create a <a href=\"https:\/\/documentation.codeship.com\/pro\/builds-and-configuration\/services\/\">Codeship Services configuration file<\/a>. Add a <a href=\"https:\/\/documentation.codeship.com\/pro\/builds-and-configuration\/steps\/\">Codeship Steps<\/a> file to your repository and your app is ready to go.<\/p>\n<p>To test out your Codeship CI configuration locally (and prevent wasting builds debugging configuration issues), you can download and run their handy CLI tool <a href=\"https:\/\/documentation.codeship.com\/pro\/jet-cli\/usage-overview\/\">Jet<\/a>.<\/p>\n<p>Because the Codeship Services file can run many containers at once, this method of automating tests makes it possible to automatically run your app in different version of the language, using different databases, or with anciliarry services connected.<\/p>\n<p>Docker has helped improve our test suite at The Graide Network as well as many open-source projects I\u2019ve worked on. If you have your own tips for using Docker to improve your test suite, <a href=\"https:\/\/twitter.com\/karllhughes\">let me hear about them on Twitter<\/a> as I\u2019m always looking to learn more.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Web Code Geeks with permission by Karl Hughes, partner at our <a href=\"\/\/www.webcodegeeks.com\/join-us\/wcg\/\" target=\"_blank\" rel=\"noopener\">WCG program<\/a>. See the original article here: <a href=\"https:\/\/blog.codeship.com\/7-ways-to-improve-your-test-suite-with-docker\/\" target=\"_blank\" rel=\"noopener\">7 Ways to Improve Your Test Suite with Docker<\/a><\/p>\n<p>Opinions expressed by Web Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying unusual server configurations, and seeding complex data make testing large applications tough. While plenty of solutions exist, I have found myself leaning on Docker more and more in the past year. Why &hellip;<\/p>\n","protected":false},"author":204,"featured_media":10356,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[217,122,121],"class_list":["post-21692","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker","tag-php","tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-05-21T09:15:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karl Hughes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karl Hughes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\"},\"author\":{\"name\":\"Karl Hughes\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f648cc42fbabad7d401f57485bdcbe28\"},\"headline\":\"7 Ways to Improve Your Test Suite with Docker\",\"datePublished\":\"2018-05-21T09:15:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\"},\"wordCount\":1577,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"keywords\":[\"Docker\",\"php\",\"Testing\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\",\"name\":\"7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"datePublished\":\"2018-05-21T09:15:23+00:00\",\"description\":\"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"7 Ways to Improve Your Test Suite with Docker\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f648cc42fbabad7d401f57485bdcbe28\",\"name\":\"Karl Hughes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7f7dd9296189dc66403a47c73e1a7ba97c94bd7858054af38c0eb9548d814bd8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7f7dd9296189dc66403a47c73e1a7ba97c94bd7858054af38c0eb9548d814bd8?s=96&d=mm&r=g\",\"caption\":\"Karl Hughes\"},\"description\":\"Karl Hughes is a startup fanatic, engineering team lead, and CTO at The Graide Network.\",\"url\":\"https:\/\/www.webcodegeeks.com\/author\/karl-hughes\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026","description":"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/","og_locale":"en_US","og_type":"article","og_title":"7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026","og_description":"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying","og_url":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2018-05-21T09:15:23+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Karl Hughes","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Karl Hughes","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/"},"author":{"name":"Karl Hughes","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f648cc42fbabad7d401f57485bdcbe28"},"headline":"7 Ways to Improve Your Test Suite with Docker","datePublished":"2018-05-21T09:15:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/"},"wordCount":1577,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","keywords":["Docker","php","Testing"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/","url":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/","name":"7 Ways to Improve Your Test Suite with Docker - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","datePublished":"2018-05-21T09:15:23+00:00","description":"I try to be disciplined in writing tests, but it\u2019s usually not long before something gets in the way. Integration-testing interdependent APIs, verifying","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/devops\/7-ways-to-improve-your-test-suite-with-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.webcodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"7 Ways to Improve Your Test Suite with Docker"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/f648cc42fbabad7d401f57485bdcbe28","name":"Karl Hughes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7f7dd9296189dc66403a47c73e1a7ba97c94bd7858054af38c0eb9548d814bd8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7f7dd9296189dc66403a47c73e1a7ba97c94bd7858054af38c0eb9548d814bd8?s=96&d=mm&r=g","caption":"Karl Hughes"},"description":"Karl Hughes is a startup fanatic, engineering team lead, and CTO at The Graide Network.","url":"https:\/\/www.webcodegeeks.com\/author\/karl-hughes\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/21692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/204"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=21692"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/21692\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/10356"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=21692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=21692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=21692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}