2019-09-testcontainers-workshop-TaCon

Slides & projects for the TaCon Live Coding Session "Testcontainers: einfach Docker Container in Tests einbinden"


Project maintained by tmstff Hosted on GitHub Pages — Theme by mattgraham

youtrain-integrationtest

Run Tests

You can run the tests either using a locally installed Webdriver oder using a Webdriver from a Selenium Grid running in docker compose. A Webdriver is required by the tests for browser automation.

Running with local Webdriver

For local development it’s useful to install the chrome and / or firefox WebDrivers:

You can run the tests from your IDE or via command line:

./gradlew test

By default the local Chrome Webdriver will be used. If you want to use another Webdriver, you can configure it in src/test/resources/GebConfig.groovy by changing the value for driver (e.g. driver = 'firefox').

Running on Selenium Grid

First you need to start the Selenium Grid:

docker-compose up -d

Use VM options geb.env=chromeGrid or geb.env=firefoxGrid to use Selenium Grid for the tests, e.g.

$(./bin/set_host_ip.sh) # Run for each new shell and after each network interface change
env "geb.env=chromeGrid" ./gradlew test

in case of problems with the dot in the variable name use the following instead:

$(./bin/set_host_ip.sh) # Run for each new shell and after each network interface change
geb_env=chromeGrid; ./gradlew test

To use Selenium Grid from the IDE, you can give the following extra VM option:

-Dgeb.env=chromeGrid -DHOST_IP=w.x.y.z

Technologies