Behat
Behat is framework used to automate testing in PHP applications.
A good intro to Behat is available here: http://docs.behat.org/en/v2.5/quick_intro.html
Acceptance Criteria
The acceptance criteria on a ticket would ideally be written before we start work on the ticket, and use the standard Gherkin format. This format should be understood by the Project Manager and Developers, with the client being guided through it as the tickets are created, and the project evolves.
https://cucumber.io/docs/guides/overview/
Setup
We want our behat installation to be managed by composer, so in the project's composer.json make sure that behat is listed there under require-dev
.
"require-dev": {
"behat/mink": "~1.7",
"behat/mink-goutte-driver": "~1.2",
"behat/behat": "3.3.1",
"behat/gherkin": "4.4.5",
In our .lando.yml
file we should already have the correct settings for Lando to run behat, having this under the tooling:
section:
behat:
service: appserver
cmd:
- "bin/behat"
In the gitroot directory you should find a behat.example.yml
file that you can copy into behat.yml
in order to beging running your behat tests.
You should also find a features
folder in the same directory, this contains all of our pre-defined behat tests and this is where you can add your own.
Running tests
If everything is order you should be able to just run lando behat
in your gitroot directory. If it doesn't run you can begin debugging by first trying to run behat in the appserver
container directly, by lando ssh appserver
first and then just running behat from there with bin/behat
.
Last updated: