CucumberJVM template project for running tests in parallel.
This project was based on Selenium-Maven-Template and support for CucumberJVM was added
- 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.
- Using cucumber-jvm-parallel-plugin (use profile
parallelPlugin
)- cucumber-jvm-parallel-plugin will automatically generates "runner" classes.
- More on this read here.
./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.
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 |
Reports are generated by maven-cucumber-reporting plugin and can be found under target/site/cucumber-reports/cucumber-html-reports
docker-compose -f docker/docker-compose-selenium.yml up
docker-compose scale selenium-hub=1 firefox=5 chrome=5
- 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
- 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/
docker-compose -f docker/docker-compose-zalenium.yml up --force-recreate
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.