Sep 19, 2018

Benefits of testing by Docker compared to testing locally

  •     The lifecycle of the containers is tied to test execution, so the tests can always run from scratch with a known, clean state. Tests that end up altering the test environment will not interfere with subsequent tests as the containers will be destroyed.
  •     The entire configuration of the Docker containers is specified in a docker-compose.yml file alongside the test source
  •     The Docker containers can leverage the features of Docker networking. For example, using a user-defined bridge or overlay network allows the tests to run in an isolated subnet, so port contention between container processes and the host will no longer be an issue.
  •     Pushing images to a Docker registry allows distribution to happen automatically. Arquillian-Cube will pull the necessary tagged images prior to running the tests. This increases the likelihood of repeatable tests; every developer and continuous integration server will be using the same images.
  •     Docker images used by the tests can be customized and tagged so you always know what the test is using. Changes made to your testing infrastructure can be tracked.