Selenium UI Tests can be executed using docker compose making it easier to run suites from local machine. Some of the advantages are listed below:
- Tests can be executed in different browser versions and platforms
- Supports Video recording of Test Execution
- Ability to scale based on the need
- With compose, its easy to setup and run tests on Selenium Grid. Grid configurations will be part of compose yaml file
- Run tests locally before merging the code
- Saves time executing multiple tests locally
- The test framework uses Maven for managing dependencies
- TestNG framework is used to write the test
- This setup is created to ensure we can easily run existing testng suites using docker compose
- Please follow instructions from Docker Desktop community from here
- AFter installing Docker Desktop in windows, need to install WSL. Have a read about it here
- In this project i have created Docker Compose yaml file using instruction from Selenium Docker Git Community
- Note: Video recording is in beta stage and we are expecting more changes around this
- Docker compose file is located /DockerCompose/docker-compose.yml
- Ensure install Maven software and add details to Environment path
- Java Environment parameters needs to be added
- Open Powershell using Administrative access
- Naviagate to Project path using cd C:**\DockerCompose
- Run .\runTestsDockerCompose.ps1 command
- Starts Docker Desktop application
- Executes Docker Compose up commands. Sets Selenium Grid Hub and Nodes as per yaml file
- Run Tests
- Executes Docker Compose down commands.
- Closes Docker Desktop application
- Start Docker Compose Desktop
- Open Command prompt or powsershell, navigate to Project Base Directory
- Run docker-compose up command. This will pull selenium docker images if not found in docker desktop and starts the services
- docker-compose up -d command will give less information when lauching selenium grid
- Go to Eclipse or IDE and right click testngDockerCompose.xml file. Run As --> TestNG Suite
- After Test Execution is completed, run docker-compose doen from command line
- Video file will be generated in test-output/videos folder. This can be changed from yaml file