A self-contained Docker image to run Behat with no external dependencies
10K+
A self-contained Docker image to run Behat with no external dependencies.
This image is part of the Docksal project.
Features:
Use this image as if you were using a binary.
Working directory is expected to be mounted at /src in the container.
$ docker run --rm -v $(pwd):/src docksal/behat --version
behat version 3.1.0
You can also add a shell alias (in .bashrc, .zshrc, etc.) for convenience.
alias behat='docker run --rm -v $(pwd):/src docksal/behat --colors "$@"'
Restart your shell or open a new one, then
$ behat --version
behat version 3.1.0
Sample setup and tests can be found in the example folder.
Features:
git clone https://github.com/docksal/behat.git docksal-behat
cd docksal-behat/example
./run-behat features/blackbox.feature
To run Behat tests that require a real browser (e.g. for JavaScript support) a headless Selenium Chrome/Firefox can be used.
There is a Docker Compose configuration in the example folder, that will get you up and running with a Selenium Chrome
cd example
docker-compose up -d
./run-behat features/blackbox-javascript.feature
Uncomment a respective line in docker-compose.yml:
# Pick/uncomment one
image: selenium/standalone-chrome
#image: selenium/standalone-firefox
Update container configuration
docker-compose up -d
Update behat.yml as necessary
Chrome
browser_name: chrome
selenium2:
wd_host: http://browser:4444/wd/hub
capabilities: { "browser": "chrome", "version": "*" }
Firefox
browser_name: firefox
selenium2:
wd_host: http://browser:4444/wd/hub
capabilities: { "browser": "firefox", "version": "*" }
Run tests
HTML report will be generated into the html_report folder.
It can be accessed by navigating to http://<your-docker-host-ip>:8000/html_report in your browser.
Replace <your-docker-host-ip> as necessary (e.g. localhost).
The following command will start a bash session in the container.
docker run --rm -v $(pwd):/src -it --entrypoint=bash docksal/behat
Content type
Image
Digest
Size
24.4 MB
Last updated
over 5 years ago
docker pull docksal/behatPulls:
12
Jun 29 to Jul 5