How to Dockerize your functional test cases

How to Dockerize your functional test cases

In this article, we will be discussing how to run functional test cases using Docker image.

Why Docker?

Running test cases in a different environment is a complex process. And this process requires a lot of setup that can still easily fails when run on different environments. Installing and maintaining different browsers takes time and most of the test fails because of different OS version and screen resolution.

So all these dependencies will be eliminated by simply running the same Docker file in different environments to test your application.

Prerequisites

Need to have docker installed in your system. If you want to setup Docker then follow our blog

Setting up Docker image

  • Use any maven Java docker image
  • Download and install Chrome browser
  • Add your project to the docker container
  • Download chrome driver and provide access permission
  • Now build your project using maven command

Here’s a simplified Dockerfile. It illustrates this approach.

Build Docker image

Once your Docker file is created, simply pull your project from Github repo in the same directory where Docker file is placed.

And run below command to build your Docker file

Run Docker image

After building your Docker image, use below command to run your functional test cases.

Leave a Reply

Your email address will not be published. Required fields are marked *