Successfully reported this slideshow.

Session on Launching Selenium Grid and Running tests using docker compose and maven – step by step demo by Aditya Garg

0

Share

1 of 28
1 of 28

Session on Launching Selenium Grid and Running tests using docker compose and maven – step by step demo by Aditya Garg

0

Share

Aditya Garg delivered a session on "Launching Selenium Grid and Running tests using docker compose and maven – step by step demo" at #SeleniumSummit21

Aditya has over 25 years of IT experience and has been a test architect and principal consultant. Aditya is an Agile and DevOps coach and loves taking test automation and DevOps solutioning work. He is a ServiceNow enthusiast and loves everything about the tool.

To know more about #SeleniumSummit21 please check : https://seleniumsummit21.agiletestingalliance.org/

Aditya Garg delivered a session on "Launching Selenium Grid and Running tests using docker compose and maven – step by step demo" at #SeleniumSummit21

Aditya has over 25 years of IT experience and has been a test architect and principal consultant. Aditya is an Agile and DevOps coach and loves taking test automation and DevOps solutioning work. He is a ServiceNow enthusiast and loves everything about the tool.

To know more about #SeleniumSummit21 please check : https://seleniumsummit21.agiletestingalliance.org/

More Related Content

More from Agile Testing Alliance

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Session on Launching Selenium Grid and Running tests using docker compose and maven – step by step demo by Aditya Garg

  1. 1. ADITYA GARG LAUNCHING SELENIUM GRID AND RUNNING TESTS USING DOCKER COMPOSE AND MAVEN – STEP BY STEP DEMO @adigindia https://www.linkedin.com/in/adigarg/
  2. 2. Launching Selenium Grid and Running tests using docker compose and maven – step by step demo
  3. 3. 1.Selenium Grid 2.Docker and docker compose 3.Maven and docker compose Three main things will get covere d
  4. 4. Aditya Session ⓘ Start presenting to display the poll results on this slide.
  5. 5. LITTLE BACKGROUND ON GRID
  6. 6. LITTLE BACKGROUND ON GRID java -jar selenium-server-standalone-3.141.59.jar -role hub java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server- standalone-3.141.59.jar -role node -hub http://192.168.0.114:4444/grid/register/ -port 5555 -browser browserName="chrome",version=ANY,platform=WIN10,maxInstances=5 It can get cumbersome Have you used some of these command s and tried creating a Grid ?
  7. 7. STEPS THAT I WILL TRY TO DEMO 1 Launching simple Chrome Debug Selenium Grid, Running and Viewing Tests 2 Launching simple Firefox Debug Selenium Grid, Running and Viewing Tests 3 Using Docker-compose creating grid and running the tests 4 Running tests using Maven Plugin for docker-compose on the fly grid creation and destruction
  8. 8. I am using an Ubuntu 16.04.6 VM on a cloud with the following setup. - JDK 1.8 - Maven - Docker 164.52.193.131
  9. 9. Selenium Test that I am going to use is simple 1. Visit SeleniumSummit21 site 2. Wait for the title to have #SeleniumSummit21 3. Go to speaker page 4. Get all the names of the speakers
  10. 10. Demo 0 – Normal Selenium Test
  11. 11. Launching simple Chrome Debug Selenium Grid, Running and Viewing Tests 1
  12. 12. Demo 1 – Creating a Chrome Debug Grid and running the test on that Grid, viewing from VNC Server
  13. 13. REFERENCE 1 https://github.com/SeleniumHQ/docker- selenium#debugging docker run -d -p 4444:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome:4.0.0-beta- 1-prerelease-20210204 Running Chrome Stand alone Debug Grid (single hub/node) – testing purposes 164.52.193.131:4444
  14. 14. client RemoteWebDriver http://<ipAddress>:<port>/wd/hub WebDriver driver; ChromeDriver FirefoxDriver Schemat ic used
  15. 15. 2 Launching simple Firefox Debug Selenium Grid, Running and Viewing Tests
  16. 16. Demo 2 – Creating a Firefox Debug Grid and running the test on that Grid, viewing from VNC Server
  17. 17. docker run -d -p 4445:4444 -p 5901:5900 -v /dev/shm:/dev/shm selenium/standalone-firefox:4.0.0- beta-1-prerelease-20210204 Running Firefox Stand alone Debug Grid (single hub/node) – testing purposes 164.52.193.131:4445 docker ps -a
  18. 18. 3 Using Docker-compose creating grid and running the tests
  19. 19. Installing docker compose sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)- $(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version Reference2 :
  20. 20. version: "3" services: hub: image: selenium/hub ports: - "4446:4444" chrome1: image: selenium/node-chrome depends_on: - hub environment: - HUB_HOST=hub chrome2: image: selenium/node-chrome depends_on: - hub environment: - HUB_HOST=hub docker-compose.yaml Image reference: https://www.qekafe.com/selenium-grid-formation-using- docker-compose up -d
  21. 21. docker-compose scale <service name> = <no of instances> docker-compose scale chrome2 = 3 docker-compose up --scale chrome2=3 -d Scaling nodes at run time
  22. 22. Demo 3 – Running tests on the selenium grid created using docker-compose.yaml file
  23. 23. 4 Running tests using Maven Plugin for docker-compose : on the fly grid creation and destruction while running the tests
  24. 24. Reference: https://github.com/dkanejs/docker- compose-maven-plugin <dependency> <groupId>com.dkanejs.maven.plugins</gro upId> <artifactId>docker-compose-maven- plugin</artifactId> <version>$VERSION</version> </dependency> <plugin> <groupId>com.dkanejs.maven.plugins</groupId> <artifactId>docker-compose-maven-plugin</artifactId> <version>2.5.1</version> <executions> <execution> <id>pull</id> <phase>validate</phase> <goals> <goal>pull</goal> </goals> <configuration> <composeFile>${project.basedir}/docker-compose.yaml</composeFile> <ignorePullFailures>true</ignorePullFailures> </configuration> </execution> <execution> <id>up</id> <phase>validate</phase> <goals> <goal>up</goal> </goals> <configuration> <composeFile>${project.basedir}/docker-compose.yaml</composeFile> <detachedMode>true</detachedMode> </configuration> </execution> <execution> <id>down</id> <phase>test</phase> <goals> <goal>down</goal> </goals> <configuration> <composeFile>${project.basedir}/docker-compose.yaml</composeFile> <removeVolumes>true</removeVolumes> </configuration> </execution> </executions> </plugin>
  25. 25. Demo 4 – Running tests on the selenium grid created using docker-compose.yaml file, on the fly by maven plugin. This can now be part of any CI tool Create and execute grids on demand..
  26. 26. SUMMARY 1 Launching simple Chrome Debug Selenium Grid, Running and Viewing Tests 2 Launching simple Firefox Debug Selenium Grid, Running and Viewing Tests 3 Using Docker-compose creating grid and running the tests 4 Running tests using Maven Plugin for docker-compose on the fly grid creation and destruction
  27. 27. QUESTIONS ? • @adigindia • https://www.linkedin.c om/in/adigarg/

×