Site icon Vinsguru

Selenium WebDriver – Running Dockerizied Automated Tests using Portainer

Overview:

TestAutomationGuru has already released few articles on creating a docker image with your tests + all the dependencies and running them on a docker container as and when we want!

  1. Running Automated Tests Inside A Docker Container
  2. Running Multiple Test Suites using Docker Compose

In the above articles, even if we had automated the process of creating a docker image etc, we were still running/managing docker containers manually.  We could automate that using a shell script etc & manage the execution through Jenkins. It is a fair point!   But if you need to do a lot of docker stuff and you / your team members, are not comfortable with command-line, then you could use a GUI tool which abstracts these docker commands.

This article is going to explain one such GUI tool – Portainer – for docker. I am going to re-use some of the artifacts I had created as part of above articles. So, Please read above articles if you have not already!

Portainer:

Portainer is a simple tool with a nice GUI to manage docker containers, images, networks, volumes etc on a host! Portainer itself is running as a docker container (portainer image is only 10MB).

Run the below command once & you are set!

sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v /opt/portainer:/data portainer/portainer

Now access the portainer dashboard using http://[ip address]/:9000

Now you could use those tabs on the left navigation to manage docker containers, images, networks, volumes etc.

Lets see how we could use it to run our tests!

Docker Image:

I had created a docker image which contains our selenium tests as part of this article – Running Multiple Test Suites using Docker Compose

 

It is basically a single image – based on the module name we pass as environment variable, it executes the different modules.

Container Setup:

 

Summary:

Now all the team members do not need special access to the server to run the commands to manage containers – Instead with Portainer’s GUI, the team could manage docker containers and executes the test as and when it is required! No need to memorize all the docker commands!

 

Happy Testing & Subscribe 🙂

 

Share This:

Exit mobile version