kentoh - Fotolia
While the benefits of Docker for software development are well established, QA and testing teams also have a lot to gain from container technology.
Docker images include software -- and all its necessary dependences -- within a single package. Development teams can use an image to run a container on different platforms without worrying about differences in the host's OS, software configuration or host environment setup. With most cloud providers and CI/CD tools natively supporting Docker, it can be much quicker to spin up a container in the cloud or use a container to test an application than with noncontainerized alternatives.
For QA teams, there are several reasons to test an application in a Docker container and to use a Docker container to run automated test suites.
Top advantages of Docker for testers
Teams can repeatedly spin up a Docker container from an image and produce the same, unmodified application on every startup. This means Docker containers are reproducible, reusable and, therefore, well suited for destructive testing.
In destructive testing, testers might deliberately render an application unusable. These tests might attempt to crash the application with bad inputs or use security vulnerabilities to modify files critical to the application. Instead of having to reconfigure an application or development environment after performing these types of tests, QA teams can isolate the destruction to a Docker container. This saves time, enabling testers to simply kill a broken container and start a new one with a restored, working application.
Another advantage of testing applications in Docker containers is that, because containers run on a host machine as a VM, their access to the host's CPU and memory are configurable. QA testers can configure a Docker container's CPU and memory with different values to test and better understand application performance with different compute resources.
This sort of testing helps an organization make important decisions about cloud infrastructure. For example, it can determine whether an application performs best with a certain CPU and memory setting. Then, teams can decide whether to scale cloud infrastructure vertically with fewer larger instance types or horizontally with many smaller instance types.
Run tests with Docker containers
Containerizing an application's automated test suite offers similar benefits to containerizing an application. QA staff can run a test on any machine as a container, locally or in the cloud, ensuring the same execution, regardless of OS or the host's environment setup.
Test automation frameworks can often be tedious to set up, requiring different dependencies than the application under test. With a container to run an application's tests, developers don't need to go through any complicated setup -- they can just run the container. This pushes testing up in the development lifecycle, where developers are able to run tests sooner, perhaps even before pushing code to a feature branch. Shortening the feedback loop improves code quality and reduces time to release new features.
Setting up tests to run in CI/CD environments or in the cloud is often much quicker with a container than with noncontainerized equivalents. For example, containers make it easier to parallelize a test suite. Testers can run multiple containers simultaneously and split tests among those containers. This reduces the time necessary to execute a test suite. If a QA tester's machine can't handle the load of running many containers at once, CI/CD or cloud services can provide computing power to simultaneously run many containers and, therefore, tests.
Ease of use facilitates more testing
By encapsulating an application in a container, QA engineers can simplify test setup and be less concerned about breaking the environment with destructive tests. Encapsulating a test suite in a container enables greater test portability, which makes the tests more valuable and easier to use, encouraging developers to test earlier and more often.