Docker for Software Testing

Gone are the days where we had different physical systems for developing & testing applications and along with the setup of dependent software. The development of virtualizing hardware inside the system broke away those physical limitations.

It’s a tiring process for a QA team, to build and maintain the test infrastructure that is needed for Test Automation. Though we have cloud services like browser stack, sauce Labs who provide the needed virtualization, comes with their own limitations like cost, performance and security challenges.

On the other hand, Docker is a light weight platform which allows to pack your app in a container with all its required dependencies thereby setting up the Test Automation infrastructure easily, especially with open source Test automation tools like Selenium and Appium (along with their respective packages / servers), where there is no cost involved.

Quick information on Selenium, Appium and Docker Containers:

Selenium is an open source UI Test automation framework for web and web-based applications. It simulates user actions on different Web browsers and validates the functional flow of the Web application. It uses “Selenium-Grid” concept to run the test scripts in parallel distributed infrastructure to pace up the Test Automation execution speed.

Appium is an open source mobile automation tool. It supports Native, Web and Hybrid applications across platforms (Android and iOS). It uses Client-Server architecture to create a communication channel that translates the selenium scripts to device understandable commands.

A Docker image is an opensource tool that provides platform as a service. It uses virtualization at OS-level to deploy software in independent packages. These packages can be read, modified and executed with help of Containers. The advantage of containers, these are isolated from one another and bundle their own software, libraries and configuration files.

Breach of Security or not

Our Security Testing Services are a must

Read More

Now let’s understand on how to leverage Docker Container for a test runner, a selenium Grid, and an appium server, to construct a flexible and disposable test automation infrastructure.

                                                                                Selenium appium architecture using docker

Test Runner container:

Test Runner is a typical illustration of a test automation tool/ framework. In addition to test automation framework, one should consider dependent libraries and their version, platform/ environment utilities and their access. These automation solutions and their dependencies can be effectively dockerized (bundled) into a docker image.

Selenium-Grid container:

Selenium-Grid container has Selenium Hub and node servers. It allows to run test scripts in parallel and in distributed fashion where different tests can run at the same time on different machines to save execution duration. Selenium Hub is center for managing which machine your Selenium test will run on. To run a Selenium test, we have to configure the machine and browser related information. Based on the configured details the test will execute on the desired machine and browser combination.

Selenium servers using docker

We have to install Selenium servers over multiple machines which is a tedious job. To make this process easy, selenium provides a docker image for Selenium servers. By running Selenium servers (hub and node) in containers, it is very easy to setup and configure the Hub server and to scale up the number of node server containers.

Even more, there are a few open source projects that provide extra functions for Selenium-Grid by extending the Selenium Docker image. Zalenium is one open source project powered by Zalando. It is highly flexible and auto scalable. It has ability to spin up selenium docker containers instantly as nodes without any manual intervention.

The main objective of Zalenium is to have a disposable and flexible Selenium Infrastructure for everyone and in an automated fashion. It also has video recording feature that can be viewed using a VNC player which is live preview board.

Zalenium provides docker-selenium nodes that are created on-demand and disposes of itself after test execution without providing any commands. With this, the test cases can run very fast.

                                                                                                 Zelenium container

Appium container:

Let’s have a look at the software required for mobile automation setup with Appium.

  • Appium
  • Supported programming language and it’s runners
  • Build tools like Node
  • Mobile device’s dependent libraries
  • Android and Java environments
  • Testing framework
  • Android Emulators or real devices
  • iOS Simulators or real devices

Appium framework may not run as per the requirement even if there is any problem with one of the software. This will be definitely a difficult job to configure, scale, maintain and dispose.

Will bundling all these software in a single container make my work easy?

Yes, in docker Hub, there are some images such as appium which contains all of appium’s dependencies in the docker form.
The main goal is to help the user focus on writing the UI tests by leveraging the advantages of using a docker like

  • Having readymade test infrastructure to deploy on demand.
  • To switch between cloud platforms easily
  • No need to expertise on how to install and configure the dependency tools
  • Tester can primarily focus on writing tests and achieve efficiency and effectiveness in results
Appium-servers-using-docker
                                                                                      Appium servers using docker

In Summation:

Docker can be leveraged for automation testing in addition to providing packaging and deployment support for software quality assurance services. This helps in setting up and scale out remote servers either for web UI or mobile testing, easily. By having an isolated and stable environment, where everyone can perform testing inside a container to verify the system functions at any development stage.

Is Your Application Secure? We’re here to help. Talk to our experts Now

Inquire Now

All containers in this infrastructure can be created on demand and destroyed when the job is done. It makes the test infrastructure more flexible and maximizes the availability of machines and devices.



Author: Bali Reddy
Balireddy works for Indium software as Test Engineer in the field of Software Test Automation. He has good knowledge in writing Selenium Automation scripts using Java and C#. And has experience working with other frameworks like Cucumber and Protractor.