Slide 1

Slide 1 text

Easy Setup for Parallel Test Execution with Selenium Docker Sargis Sargsyan 

Slide 2

Slide 2 text

2 Sargis Sargsyan Principal Software Engineer in Test

Slide 3

Slide 3 text

3 Introduction to Presentation  1 Why? 2 What is Selenium Grid 3 What is Docker Selenium 4 Configure Selenium Grid in Docker Containers 5 Running Selenium Suite in Parallel 6 Creating and maintaining docker-compose file 7 View test execution using debug nodes via VNC 9 Q&A 8 Zalenium + Sauce Labs

Slide 4

Slide 4 text

 Why we should run our test in Parallel? Why?

Slide 5

Slide 5 text

5 Why?  Why we should run tests in Parallel Running Selenium tests is slow. Parallel testing is allowing us to speed up the test runtime. Also it allows us to increase coverage and run tests in different browser on the same time. Parallel Test Running Possibility to test more than one set of configurations Save Time! Reduce the time of test suite run Cost per Test to run More browser/OS coverage Fast feedback Less Manual Testing

Slide 6

Slide 6 text

6 Disadvantages  What are the disadvantages of Selenium Grid The performance of Selenium grid is low, in case if you are running large amount of the test and need large amount of nodes Setting up parallel running test suite requires time In case of large amount of tests it will be necessary to divide the suite into parts and run them in different machines If the suite was divided to pars there will be some difficulties in analyzing statistics, as there will be divided reports As the code is executed on the same machine the test were launched and the machine only receives the browser control commands. It is creating issues with uploading or downloading files

Slide 7

Slide 7 text

 What is Selenium Grid

Slide 8

Slide 8 text

8 What is Selenium Grid  Selenium Grid is a smart proxy server that allows Selenium tests to route commands to remote web browser instances. Its aim is to provide an easy way to run tests in parallel on multiple machines. With Selenium Grid, one server acts as the hub that routes JSON formatted test commands to one or more registered Grid nodes. Tests contact the hub to obtain access to remote browser instances. The hub has a list of registered servers that it provides access to, and allows us to control these instances. Selenium Grid allows us to run tests in parallel on multiple machines, and to manage different browser versions and browser configurations centrally (instead of in each individual test). Selenium Grid isn't a silver bullet. It solves a subset of common delegation and distribution problems, but will for example not manage your infrastructure and might not suit your specific needs. Selenium Grid a *SeleniumHQ Documentation Diagram from https://www.ranorex.com

Slide 9

Slide 9 text

9 What is Selenium Hub and Nodes  • Intermediary and manager • Accepts requests to run tests • Takes instructions from client and executes them remotely on the nodes • Manages threads Hub a *SeleniumHQ Documentation • This is where the browsers live • Registers itself to the hub and communicates its capabilities • Receives requests from the hub and executes them Nodes

Slide 10

Slide 10 text

10 Docker Selenium Grid  • Selenium hub image • Selenium node-firefox image • Selenium node-chrome image • Selenium node-firefox-debug image • Selenium node-chrome-debug image Selenium Images a *SeleniumHQ Documentation As normal grid with docker we have to install the hub and browser nodes into Docker containers and then start the hub and nodes from the Docker container. Selenium Grid with Docker

Slide 11

Slide 11 text

 A flexible and scalable Selenium Grid Zalenium

Slide 12

Slide 12 text

12 Zalenium  A grid that scales using docker-selenium Ƽ Hard to maintain a Selenium Grid Ƽ Allow anyone to have a disposable and flexible Selenium Grid infrastructure Why Zalenium? What is Zalenium? Dinamic, on-demand Selenium Grid Based on docker-selenium Simple to setup and run a * Zalenium

Slide 13

Slide 13 text

13 Zalenium Additional Features  Get a grid up and running in a few seconds! Test status and steps directly in the video Basic auth grid protection when deploying Zalenium in the cloud (AWS, GCP, …) Mount volumes across containers when you need to specific files in your tests a * Zalenium

Slide 14

Slide 14 text

14 How It Works?  Zalenium works conceptually in a simple way a * Zalenium

Slide 15

Slide 15 text

15 How It Works?  Zalenium works conceptually in a simple way a * Zalenium

Slide 16

Slide 16 text

16 How to Build Zealenium?  Zalenium works conceptually in a simple way a * Zalenium docker pull elgalu/selenium docker pull dosel/zalenium

Slide 17

Slide 17 text

17 How to Build Zealenium?  Zalenium works conceptually in a simple way a * Zalenium docker run --rm -ti --name zalenium -p 4444:4444 \ -e DOCKER=17.06.2-ce \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/videos:/home/seluser/videos \ --privileged dosel/zalenium start

Slide 18

Slide 18 text

 Zalenium works conceptually in a simple way How to Build Zealenium?

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

20 How to Build Zealenium with docker-compose?  Zalenium works conceptually in a simple way a * Zalenium # Usage: # docker-compose up --force-recreate version: '2.1' services: zalenium: image: "dosel/zalenium" container_name: zalenium hostname: zalenium tty: true volumes: - /tmp/videos:/home/seluser/videos - /var/run/docker.sock:/var/run/docker.sock - /usr/bin/docker:/usr/bin/docker ports: - 4444:4444 command: > …………………………. ………………………….

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

 Zalenium works conceptually in a simple way How to Run Test?

Slide 23

Slide 23 text

23 How to Build Zalenium?  Zalenium works conceptually in a simple way

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

 Zalenium works conceptually in a simple way View browser via VNC in Zalenium?

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

 Cloud-hosted web and mobile application automation platform Sauce Labs

Slide 28

Slide 28 text

28 Sauce Labs  A flexible and scalable Selenium Grid As the co-developers of Selenium, our team maintains the most up-to-date and reliable platform for web testing. Test securely knowing that our experts can help your organization build their test automation strategy. What is Sauce Labs Ƽ Run Selenium tests in real browsers in cloud Write test in most popular languages Specify platform configuration Spent less time to setting up and maintaining your testing infrastructure a * Sauce Labs

Slide 29

Slide 29 text

29 Sauce Labs  A flexible and scalable Selenium Grid a * Sauce Labs

Slide 30

Slide 30 text

30 How to Run Tests Against Sauce Labs?  Cloud-hosted web and mobile application automation platform

Slide 31

Slide 31 text

 Cloud-hosted web and mobile application automation platform How to Run Tests Against Sauce Labs?

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

 Redirect the test to a cloud testing provider Zalenium + Sauce Labs

Slide 34

Slide 34 text

34 Zalenium + Sauce Labs  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam. If you need a capability that cannot be fulfilled by docker-selenium, the test gets redirected to a cloud testing provider (i.e. Sauce Labs) Zalenium + Sauce Labs

Slide 35

Slide 35 text

35 How to Build Zealenium with Saucelabs?  Zalenium works conceptually in a simple way a * Zalenium export SAUCE_USERNAME= export SAUCE_ACCESS_KEY= export SAUCE_LABS_URL=

Slide 36

Slide 36 text

36 How to Build Zealenium with Saucelabs?  Zalenium works conceptually in a simple way a * Zalenium docker run --rm -ti --name zalenium -p 4444:4444 \ -e SAUCE_USERNAME -e SAUCE_ACCESS_KEY -e SAUCE_LABS_URL\ -v /tmp/videos:/home/seluser/videos \ -v /var/run/docker.sock:/var/run/docker.sock \ --privileged dosel/zalenium start --sauceLabsEnabled true

Slide 37

Slide 37 text

37 How to Build Zealenium with Saucelabs?  Zalenium works conceptually in a simple way

Slide 38

Slide 38 text

38 Create Remote Driver for Chrome  Zalenium works conceptually in a simple way

Slide 39

Slide 39 text

 Zalenium works conceptually in a simple way Run Selenium Tests on Chrome

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

41 Create Remote Driver for Chrome / Windows  Zalenium works conceptually in a simple way

Slide 42

Slide 42 text

 Zalenium works conceptually in a simple way Run Selenium Tests on Chrome / Windows

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

44 Tools and Services  Selenium Web Driver Zalenium/Selenium Grid Sauce Labs Docker https://github.com/sargissargsyan/selenium-parallel-run

Slide 45

Slide 45 text

45 Thank You!  Ñ [email protected] t @sargisset ą /in/sargissargsyan