Roman Tretyak.
Test Automation Architect
Docker
Enterprise Application Container
3
Obvious advantages:
• Convenient application
encapsulation..
• Understandable monitoring. .
• Work with Linux, MacOs,
Windows.
Terminology
Docker is used to run software packages called containers. Containers are isolated from
each other and bundle their own application, tools, libraries and configuration files.
Containers are an abstraction at the app layer that packages code and dependencies
together. Containers take up less space than VMs (container images are typically tens of
MBs in size), can handle more applications and require fewer VMs and Operating
systems.
An instance of an image is called a container. You have an image, which is a set of
layers as you describe. If you start this image, you will have a running container of this
image. You can have many running containers of the same image.
Docker
Install docker on Mac/Windows
4
Additional info :
• Advanced (CPUs: 3, Memory:
2048 MB, Swap: 2048 MB)
• Daemon (Experimental
features checkbox unmarked)
.
• *Shared Drives (Drive C should
be shared - checkbox marked)
Install latest Docker for Windows
https://hub.docker.com/editions/community/docker-ce-desktop-
windows
Install latest Docker for Mac
https://hub.docker.com/editions/community/docker-ce-desktop-mac
unzip latest Kitematic to ./Docker/Kitematic folder
Docker
Additional commands:
5
• kill all running containers with docker kill $(docker ps -q)
• delete all stopped containers with docker rm $(docker ps -a -q)
• delete all images with docker rmi $(docker images -q)
Selenium grid
Selenium grid disadvantages
6
Time-consuming deployment process
1.Install Java Development Kit
2.Download Selenium Server JAR latest version
3.Download Web driver required versions
4.Unzip Web driver
5.Install the required versions of browsers
6.Input long commands.
Performance speed reduction
The hub decelerates if multiple browsers are run in
different nodes.
Complex launch commands
Selenoid
Selenium server/grid vs Selenoid
7
Features:
• Isolated environment
• Resources consumption and utilization
• Installation
• Support of multiple browser versions
• Focus
• User interface and logs
Selenoid
Isolated environment
8
• Selenoid allows running each browser in a separate
container, which enables full isolation of the browser
environment.
Selenoid
Resources consumption and utilization
9
• Since the Selenium Server is written in Java, the resources
consumption under heavy load increases significantly.
• Selenoid enables to maintain a high load without additional
waste of resources.
• On average, during 10 running sessions Selenium Server
consumes 500 MB of RAM, while the rate of Selenoid is only
50-60 MB.
• In addition, all inactive containers are removed at the end of
each session. Thus, the level of free memory is always
appropriate.
Selenoid
Installation
10
• Unlike Selenium Grid deployment process, the one of
Selenoid requires little time and effort. It presupposes
Docker installation and the input of one command.
Selenoid
Support of multiple browser versions
11
• Several containers with the appropriate browsers are
to be built.
Selenoid
Focus
12
• Challenges may emerge if multiple browsers are run
on the same machine within Selenium Grid.
• Selenoid allows running each test in a separate
container. Thus, this problem is eliminated.
Selenoid
User interface and logs
13
• It’s challenging to obtain logs for certain browser
sessions in terms of Selenium Grid. On the contrary,
all available logs are accessed easily in Selenoid.
• Selenoid is convenient to use due to the informative
interface.
Selenoid
Selenoid advantages
14
Selenoid advanced features:
• Data storage in RAM
• Various screen resolution types
• Browser screen display
• Video recording of tests
Selenoid
Data storage in RAM
15
• Selenoid stores all temporary files in tmpfs.
• Tmpfs is a temporary file repository that allows storing
files in RAM, access to which is performed much
faster than to the file system of the hard drive.
Selenoid
Various screen resolution types
16
• QA engineers can configure the appropriate screen
resolution for a running container on their own by
setting the required parameters in the Browser
Capabilities.
Selenoid
Browser screen display
17
• Selenoid enables engineers to connect to the Virtual
Network Computing port during tests execution and
access the screen of the desired browser.
Selenoid
Video recording of tests
18
• It’s possible to record the video of the tests performed.
• For instance, the activation in the Google Chrome
browser is implemented by setting the parameter true
in the Browser Capabilities:
Selenoid
Selenoid Ecosystem
19
Selenoid
Configuration manager
20
Important possibilities:
• change the directory of browser configuration file
• limit maximum parallel sessions
• change the video output directory
• limit memory and CPU usage
Selenoid
Selenoid UI
21
Features list:
• Stats and sessions
• Capabilities
• Logs & VNC
Selenoid
Run selenoid without docker
22
Download latest driver from selenium website
Download latest Selenoid binary.
https://github.com/aerokube/selenoid/releases/download/1.9.1/selenoid_windows_386.e
xe
https://github.com/aerokube/selenoid/releases/download/1.9.1/selenoid_darwin_amd64
Create browsers.json configuration file:
{"chrome": {
"default": "73.0",
"versions": {
"73.0": {
"image": [ ".chromedriver.exe" ] OR"image": ["./chromedriver"],
"port": "4444",
"path": "/", }}}}
Run command
chmod +x ./selenoid_darwin_amd64
chmod +x ./chromedriver
./selenoid.exe -conf ./browsers.json -disable-docker
Webdriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub/"),
new ChromeOptions());
https://github.com/aerokube/selenoid/blob/master/docs/selenoid-without-docker.adoc
Selenoid
Run selenoid using cm with docker
23
On Linux and Mac OS:
curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --vnc --last-
versions 1 --browsers chrome && ./cm selenoid-ui start
On Windows
just download the latest binary with your browser from releases page for windows (386
and amd64 binaries available). Then type:
./cm.exe selenoid start --vnc --last-versions 1 --browsers chrome
./cm.exe selenoid-ui start
Set up desired capabilities:
DesiredCapabilities cap = new DesiredCapabilities();
capabilities.setBrowserName("chrome");
capabilities.setVersion("");
capabilities.setCapability("enableVNC", true);
capabilities.setCapability("enableVideo", true);
capabilities.setCapability("enableLog", true);
capabilities.setCapability("videoName", “video.mp4");
capabilities.setCapability("logName", “log.log");
Webdriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub/"),
capabilities);
https://aerokube.com/cm/latest/
Selenoid
Run selenoid using docker-compose
24
Create configuration browsers.json file.
{"chrome": {
"default": "latest",
"versions": {
"latest": {
"image": "selenoid/vnc:chrome_73.0",
"port": "4444",
"path": "/", }}}}
Selenoid
Create docker-compose.yml
25
Selenoid
Create docker-compose.yml
26
Run:
docker-compose up -d --no-deps
http://localhost:4444/video/
http://localhost:4444/logs/
http://localhost:8080/
Questions
27

Selenoid

  • 2.
  • 3.
    Docker Enterprise Application Container 3 Obviousadvantages: • Convenient application encapsulation.. • Understandable monitoring. . • Work with Linux, MacOs, Windows. Terminology Docker is used to run software packages called containers. Containers are isolated from each other and bundle their own application, tools, libraries and configuration files. Containers are an abstraction at the app layer that packages code and dependencies together. Containers take up less space than VMs (container images are typically tens of MBs in size), can handle more applications and require fewer VMs and Operating systems. An instance of an image is called a container. You have an image, which is a set of layers as you describe. If you start this image, you will have a running container of this image. You can have many running containers of the same image.
  • 4.
    Docker Install docker onMac/Windows 4 Additional info : • Advanced (CPUs: 3, Memory: 2048 MB, Swap: 2048 MB) • Daemon (Experimental features checkbox unmarked) . • *Shared Drives (Drive C should be shared - checkbox marked) Install latest Docker for Windows https://hub.docker.com/editions/community/docker-ce-desktop- windows Install latest Docker for Mac https://hub.docker.com/editions/community/docker-ce-desktop-mac unzip latest Kitematic to ./Docker/Kitematic folder
  • 5.
    Docker Additional commands: 5 • killall running containers with docker kill $(docker ps -q) • delete all stopped containers with docker rm $(docker ps -a -q) • delete all images with docker rmi $(docker images -q)
  • 6.
    Selenium grid Selenium griddisadvantages 6 Time-consuming deployment process 1.Install Java Development Kit 2.Download Selenium Server JAR latest version 3.Download Web driver required versions 4.Unzip Web driver 5.Install the required versions of browsers 6.Input long commands. Performance speed reduction The hub decelerates if multiple browsers are run in different nodes. Complex launch commands
  • 7.
    Selenoid Selenium server/grid vsSelenoid 7 Features: • Isolated environment • Resources consumption and utilization • Installation • Support of multiple browser versions • Focus • User interface and logs
  • 8.
    Selenoid Isolated environment 8 • Selenoidallows running each browser in a separate container, which enables full isolation of the browser environment.
  • 9.
    Selenoid Resources consumption andutilization 9 • Since the Selenium Server is written in Java, the resources consumption under heavy load increases significantly. • Selenoid enables to maintain a high load without additional waste of resources. • On average, during 10 running sessions Selenium Server consumes 500 MB of RAM, while the rate of Selenoid is only 50-60 MB. • In addition, all inactive containers are removed at the end of each session. Thus, the level of free memory is always appropriate.
  • 10.
    Selenoid Installation 10 • Unlike SeleniumGrid deployment process, the one of Selenoid requires little time and effort. It presupposes Docker installation and the input of one command.
  • 11.
    Selenoid Support of multiplebrowser versions 11 • Several containers with the appropriate browsers are to be built.
  • 12.
    Selenoid Focus 12 • Challenges mayemerge if multiple browsers are run on the same machine within Selenium Grid. • Selenoid allows running each test in a separate container. Thus, this problem is eliminated.
  • 13.
    Selenoid User interface andlogs 13 • It’s challenging to obtain logs for certain browser sessions in terms of Selenium Grid. On the contrary, all available logs are accessed easily in Selenoid. • Selenoid is convenient to use due to the informative interface.
  • 14.
    Selenoid Selenoid advantages 14 Selenoid advancedfeatures: • Data storage in RAM • Various screen resolution types • Browser screen display • Video recording of tests
  • 15.
    Selenoid Data storage inRAM 15 • Selenoid stores all temporary files in tmpfs. • Tmpfs is a temporary file repository that allows storing files in RAM, access to which is performed much faster than to the file system of the hard drive.
  • 16.
    Selenoid Various screen resolutiontypes 16 • QA engineers can configure the appropriate screen resolution for a running container on their own by setting the required parameters in the Browser Capabilities.
  • 17.
    Selenoid Browser screen display 17 •Selenoid enables engineers to connect to the Virtual Network Computing port during tests execution and access the screen of the desired browser.
  • 18.
    Selenoid Video recording oftests 18 • It’s possible to record the video of the tests performed. • For instance, the activation in the Google Chrome browser is implemented by setting the parameter true in the Browser Capabilities:
  • 19.
  • 20.
    Selenoid Configuration manager 20 Important possibilities: •change the directory of browser configuration file • limit maximum parallel sessions • change the video output directory • limit memory and CPU usage
  • 21.
    Selenoid Selenoid UI 21 Features list: •Stats and sessions • Capabilities • Logs & VNC
  • 22.
    Selenoid Run selenoid withoutdocker 22 Download latest driver from selenium website Download latest Selenoid binary. https://github.com/aerokube/selenoid/releases/download/1.9.1/selenoid_windows_386.e xe https://github.com/aerokube/selenoid/releases/download/1.9.1/selenoid_darwin_amd64 Create browsers.json configuration file: {"chrome": { "default": "73.0", "versions": { "73.0": { "image": [ ".chromedriver.exe" ] OR"image": ["./chromedriver"], "port": "4444", "path": "/", }}}} Run command chmod +x ./selenoid_darwin_amd64 chmod +x ./chromedriver ./selenoid.exe -conf ./browsers.json -disable-docker Webdriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub/"), new ChromeOptions()); https://github.com/aerokube/selenoid/blob/master/docs/selenoid-without-docker.adoc
  • 23.
    Selenoid Run selenoid usingcm with docker 23 On Linux and Mac OS: curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --vnc --last- versions 1 --browsers chrome && ./cm selenoid-ui start On Windows just download the latest binary with your browser from releases page for windows (386 and amd64 binaries available). Then type: ./cm.exe selenoid start --vnc --last-versions 1 --browsers chrome ./cm.exe selenoid-ui start Set up desired capabilities: DesiredCapabilities cap = new DesiredCapabilities(); capabilities.setBrowserName("chrome"); capabilities.setVersion(""); capabilities.setCapability("enableVNC", true); capabilities.setCapability("enableVideo", true); capabilities.setCapability("enableLog", true); capabilities.setCapability("videoName", “video.mp4"); capabilities.setCapability("logName", “log.log"); Webdriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub/"), capabilities); https://aerokube.com/cm/latest/
  • 24.
    Selenoid Run selenoid usingdocker-compose 24 Create configuration browsers.json file. {"chrome": { "default": "latest", "versions": { "latest": { "image": "selenoid/vnc:chrome_73.0", "port": "4444", "path": "/", }}}}
  • 25.
  • 26.
    Selenoid Create docker-compose.yml 26 Run: docker-compose up-d --no-deps http://localhost:4444/video/ http://localhost:4444/logs/ http://localhost:8080/
  • 27.