Skip to content

pramesh01/selenium-docker-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Selenium-Docker-Runner

This repository contains the runner setup to execute the Selenium Automation Framework using Docker and Jenkins.
It provisions a Selenium Grid, pulls the prebuilt Docker image from DockerHub, runs tests in parallel on multiple browsers, collects reports, and then tears down the environment automatically.


πŸ“‚ Repository Contents

  • Jenkinsfile β†’ Pipeline to orchestrate test execution (Grid up β†’ Run tests β†’ Cleanup).
  • grid.yaml β†’ Spins up Selenium Grid (Hub + Chrome + Firefox nodes).
  • test_suites.yaml β†’ Runs test containers against the Grid in parallel.

βš™οΈ Workflow

πŸ”Ή Builder Pipeline (Jenkinsfile defined in my Selenium Framework Repository)

The Docker image used here (pramesh11/selenium-docker-framework) is built and pushed from the main framework repository, which contains:

  • Complete framework code (Selenium + Java + TestNG + POM).
  • pom.xml for Maven build.
  • Builder Jenkinsfile with stages to:
    1. Build the JAR (mvn clean package).
    2. Build Docker image.
    3. Push image to DockerHub (pramesh11/selenium-docker-framework).

This pipeline must run first, so that the latest Docker image is available on DockerHub.

πŸ”Ή Runner Job (this Repository)

  • Grid Up β†’ grid.yaml starts Selenium Hub and browser nodes.
  • Test Execution β†’ test_suites.yaml runs tests using the prebuilt Docker image:
    • Runs in Chrome and Firefox.
    • Stores reports in ./output/test_resultsX.
  • Validation β†’ Jenkins pipeline checks for failed tests (testng-failed.xml).
  • Teardown β†’ All containers are stopped and cleaned automatically.

▢️ Usage

Run with Jenkins

  • Two pipelines are needed:

    1. Builder Job (from framework repo) β†’ Builds & pushes Docker image.
    2. Runner Job (this repo) β†’ Executes tests on Selenium Grid.
  • Run the Builder Job first, then the Runner Job.

Run Manually (Docker Compose)

# Start Selenium Grid
docker-compose -f grid.yaml up -d

# Run tests (Chrome + Firefox)
docker-compose -f test_suites.yaml up --pull=always

# Stop and clean everything
docker-compose -f test_suites.yaml down
docker-compose -f grid.yaml down

πŸ“Š Test Reports

Reports are generated inside the output/ directory:-

  • output/test_results1 β†’ Chrome execution results
  • output/test_results2 β†’ Firefox execution results

πŸ‘¨β€πŸ’» Author: Pramesh Kumar

Thanks!

About

CI/CD-ready Dockerized Selenium Test Runner | Jenkins + Selenium Grid + Parallel Execution | Configurable test suites via YAML.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors