Skip to content
Snippets Groups Projects
Commit 78bfb53b authored by jurgenhaas's avatar jurgenhaas
Browse files

Move readme to docs

parent 7538db79
No related branches found
No related tags found
No related merge requests found
# Behat for Drupal
This composer plugin prepares your Drupal project for Behat tests.
## Requirements
The plugin works with any composer based Drupal project and can be added to such projects with `composer require lakedrops/behat4drupal`. It's recommended to also use the Docker4Drupal plugin (added with `composer require lakedrops/docker4drupal`) which will provide all the Docker containers for your development environment as well as those for Selenium and Chrome.
If your project is based on either [Drupal 8 Project Template](https://gitlab.lakedrops.com/composer/project/drupal-8) or [Drupal 9 Project Template](https://gitlab.lakedrops.com/composer/project/drupal-9), then everything is already included for you automatically.
## Usage
You will find links to further documentation on how to write Behat tests at the end of this file. Here we simply describe on how you can run your tests once they have been defined.
### Command line
The easiest way to run Behat tests is to use the prepared Ahoy commands. Just call `a behat` to get a list of all available commands. In the background, they call the same commands that are described in detail in the following paragraphs.
You need to execute Behat inside of the PHP Docker container. From the root of your project you can launch the containers with `docker-compose up -d` and then enter the PHP container with `docker-compose exec --user root php sh`.
Inside of the container you'll be located at `/var/www/html` and in that directory you can run the Behat test suite with the command `vendor/bin/behat --no-interaction --config /var/www/html/tests/behat/behat.yml`
### PhpStorm
In any of the JetBrains IDEs you can call the Behat tests directly from the UI when preparing the project in 2 steps beforehand:
- Configure the PHP CLI interpreter: Go to the project settings in **Languages & Frameworks > PHP** and configure the remote PHP interpreter for Docker similar to this screenshot ![](https://gitlab.lakedrops.com/composer/plugin/behat4drupal/uploads/f045b58e9ae4e6f8f0c3ea44baea2402/2018-09-12_16_22_46_screen.jpg)
- Configure the Run/Debug Configuration: Simply select Behat and of you go, see this second screenshot ![](https://gitlab.lakedrops.com/composer/plugin/behat4drupal/uploads/f2f33070f711e891a0b61cdea04d1116/2018-09-12_16_25_05_screen.jpg)
## Links
For more details we recommend the following links:
- Behat Documentation
- [Homepage](http://behat.org/en/latest/index.html)
- [Quick Start](http://behat.org/en/latest/quick_start.html)
- [Docs](http://docs.behat.org/en/latest)
- [Drupal Extension](https://behat-drupal-extension.readthedocs.io/en/3.1/index.html)
- [Gherkin](https://github.com/Behat/Gherkin)
- [Mink](http://mink.behat.org/en/latest/index.html)
- Others
- [Blog for Docker and Selenium](https://stefanoalletti.wordpress.com/2018/07/02/symfony-docker-behat-browserstack-testing-your-app-like-a-boss)
- [Official Selenium Docker Image](https://github.com/SeleniumHQ/docker-selenium)
- [Used Selenium Docker Image](https://github.com/elgalu/docker-selenium)
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
], ],
"support": { "support": {
"issues": "https://gitlab.lakedrops.com/composer/plugin/behat4drupal/issues", "issues": "https://gitlab.lakedrops.com/composer/plugin/behat4drupal/issues",
"source": "https://gitlab.lakedrops.com/composer/plugin/behat4drupal/tree/master" "source": "https://gitlab.lakedrops.com/composer/plugin/behat4drupal/tree/master",
"docs": "https://devops-tools.docs.lakedrops.com/composer/plugin/b4d/"
}, },
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment