iljapavlovs / kino-test

Zalenium, Selenoid and Selenium Docker examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kino-test Build Status

CucumberJVM template project for running tests in parallel.

This project was based on Selenium-Maven-Template and support for CucumberJVM was added

How to run

Execution options

  1. One "Runner" class per thread (use profile parallel). By "Runner" class is meant RunCukesCheeseTest class in this example.
    • NOTE - in order to use this approach, you will need to create separate "runner" class per one thread. Tests belonging to one "runner" class will be executed sequentially.
    • More on this read here.
  2. Using cucumber-jvm-parallel-plugin (use profile parallelPlugin)
    • cucumber-jvm-parallel-plugin will automatically generates "runner" classes.
    • More on this read here.

Command for execution

./mvnw clean verify -P [nogrid OR grid],[parallel OR parallelPlugin] -Dthreads=[number of parallel threads]
  • parallel - when using separate "runner" class per one thread
  • parallelPlugin - uses cucumber-jvm-parallel-plugin. Automatically creates separate "runner" class per one thread
  • nogrid - execute tests locally
  • grid - execute tests on Selenium Grid. Grid Hub can be set in pom by using seleniumGridUrl property or in ApplicationProperties file
  • Thread count can be set via -Dthreads argument

For example, invoking

./mvnw clean verify -P parallelPlugin,nogrid -Dthreads=3 -Dbrowser=chrome -Dcucumber.options="--tags @google"

will execute tests in parallel 3 threads on local machine and using cucumber-jvm-parallel-plugin plugin. In addition, -Dbrowser setting will set browser to Chrome.

Configuration

Following settings can be changed in lv.iljapavlovs.cucumber.config.ApplicationProperties.java or overriden by from command line by providing -D{configuration key}={value}

Configuration key Description
env environment name
appUrl AUT URL
browser Browser to use. Available options - chrome, firefox, safari, edge, ie, chrome_headless, firefox_headless
proxyEnabled is proxy enabled for Selenium (boolean)
proxyHost proxy host
proxyPort proxy port
remoteDriver should tests be executed on Selenium Grid (boolean)
seleniumGridRetries RemoteWebdriver initialization retry count
seleniumGridUrl Selenium Grid Hub URL
waitShortSeconds timeout for explicit wait - shortest timeout
waitNormalSeconds timeout for explicit wait - average timeout
waitLongSeconds timeout for explicit wait - longest timeout

Reporting

Reports are generated by maven-cucumber-reporting plugin and can be found under target/site/cucumber-reports/cucumber-html-reports

Setting up Selenium Grid in Docker Containers

Selenium

docker-compose -f docker/docker-compose-selenium.yml up
Scaling
docker-compose scale selenium-hub=1 firefox=5 chrome=5 

Selenoid

  1. Pull desired browser images for testing
docker pull selenoid/vnc:chrome_68.0

Optionally, if you want video recording enabled, then corresponding image needs to be pulled

docker pull selenoid/video-recorder
  1. Start Selenoid
docker-compose -f docker/docker-compose-selenoid.yml up

Then you can check simple status page with UI updates at

http://localhost:8080/

Zalenium

docker-compose -f docker/docker-compose-zalenium.yml up --force-recreate

Driver Download for local execution

This project uses webdrivermanager tool in order to automate the Selenium browser drivers management in runtime. It will automatically download all needed driver to your local PC if needed with specified version.

About

Zalenium, Selenoid and Selenium Docker examples


Languages

Language:Java 94.1%Language:Gherkin 5.9%