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.
- 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.
πΉ 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.xmlfor Maven build.- Builder Jenkinsfile with stages to:
- Build the JAR (
mvn clean package). - Build Docker image.
- Push image to DockerHub (
pramesh11/selenium-docker-framework).
- Build the JAR (
This pipeline must run first, so that the latest Docker image is available on DockerHub.
- Grid Up β
grid.yamlstarts Selenium Hub and browser nodes. - Test Execution β
test_suites.yamlruns 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.
-
Two pipelines are needed:
- Builder Job (from framework repo) β Builds & pushes Docker image.
- Runner Job (this repo) β Executes tests on Selenium Grid.
-
Run the Builder Job first, then the Runner Job.
# 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!