logo logo

The Ultimate Docker Tutorial for Automation Testing

main post image

Test automation is the secret to DevOps success and is essential in the world of Continuous Deployment and short deployment cycles. To achieve high speed and agility, it is important to automate our testing processes and configure them to run automatically to get automated feedback on each code commit. With TestProject you can easily integrate into your CI/CD workflow with their rich API swagger and the most popular DevOps tools, including Jenkins, Azure DevOps, and Docker! 🐳🚀

In this tutorial, we are going to focus on Docker: What is Docker, how do we set up a Docker environment, and how can we benefit from TestProject Agents in Docker containers? And more! Let’s get started with this ultimate Docker tutorial to accelerate your automation testing! 🐳👉

TestProject Test Automation Platform

Table of Contents 

  1. You’re here → Introduction to Docker & Docker Desktop
    1. Why Docker?
    2. Build, Ship & Share
    3. Docker Objects
    4. Docker Hub
    5. Docker Compose
    6. Setting up a Docker Environment
  2. Introduction to TestProject and TestProject Agent in Docker
    1. Why TestProject?
    2. Getting Started with TestProject
    3. TestProject Agent
    4. TestProject Architecture
    5. Create Your First Test with TestProject
  3. Running TestProject Agent inside Docker Container

Introduction to Docker & Docker Desktop

Why Docker?

Gone are the days when applications & their dependencies needed to be set up on different physical systems for developing, testing & making them available for the end users. The introduction of virtualizing hardware inside the same system broke away these constraints that had yet locked us in. But that too came at a price & many resources left untouched finally gave in to the concept of containerization. 

Containerized Applications

In layman’s terms it’s simply the process of packing the software & its dependencies so the application runs quickly and reliably from one computing environment to another for Development, Shipment and Deployment.

Build, Ship & Share

Docker is the de facto standard to build, run and share containerized apps – From desktop, to the cloud. Docker uses a client-server architecture in the following way: 

  • The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers.
  • The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. 
  • The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.

Docker Architecture

Docker Objects

When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects:

  • Images: An image is a read-only template with instructions for creating a Docker container. You can create your own image, using a Dockerfile with a simple syntax for defining the steps needed to create the image and run it, or build an image based on another image, with some additional customization.
  • Containers: A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
  • Services: Services allow you to scale containers across multiple Docker daemons, which all work together as a swarm with multiple managers and workers.Docker objects

Docker Hub

A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry. 

Docker Hub

Docker Compose

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. Compose is great for development, testing, and staging environments, as well as CI workflows. We will be leveraging Docker Compose towards the end of this tutorial where we will be starting a TestProject agent with headless Chrome and Firefox browsers.

Docker Compose

Setting up a Docker Environment

Follow the instructions appropriate for your operating system to download and install Docker Desktop:

After you’ve successfully installed Docker Desktop, you can verify the Docker version by clicking on whale-icon on the top left of the screen and selecting “About Docker Desktop”.

Docker Desktop

Open a terminal and run docker –version to check the version of Docker installed on your machine.

  • $ docker version

Test that your installation works by running the hello-world Docker image:

  • $ docker run hello-world

Now we are all set and familiar with Docker! Next up, we will learn where TestProject comes into the picture, what are the benefits to having TestProject Agents running inside Docker containers and how to set it up!

👉🐳 Go ahead to the next chapter

Avatar

About the author

Ajeet Singh Raina
Ajeet Singh Raina is a Docker Captain Docker Bangalore Community Leader, the largest Docker Meetup in the world with nearly 10,100+ members. He won “The Tip of Captain’s Hat Award” in Dockercon 2019 which happened in San Francisco. He bagged Docker Community Award early Jan 2020. He recently joined “ARM Innovator Program” club which includes 25 industry-leading experts and founders committed to extending ARM architecture & sharing their knowledge in IoT, AI & Security.
He is a prolific blogger, sharing Docker & Kubernetes contents on his blog Collabnix, which had over a million views in 2019. He had already authored 200+ blogs around Docker, Kubernetes & DevOps tools. He is a frequent speaker and conduct virtual events globally. His Meetups are more like mini-conferences, commonly exceeding hundreds of RSVPs and involve hands-on workshop and training content that he and his docker community have developed. Ajeet also helped to organize and/or speak at more than 30+ events over the past year.
You can reach out to him via TwitterLinkedIn & Slack. You can follow his work at GITHUB.

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Leave a Reply

FacebookLinkedInTwitterEmail