WILT: Running behave over a dockerised application
A few gotchas I hit running behave over a PHP app
Some definitions first:
behave
: This is a python implementation of Behavior Driven Development using the Gherkin syntaxgherkin
: This is a syntax for defining tests in a human readable format.
The area I'm part of at work has a high python skill base and have used behave for their testing for quite some time. I've been pulled in to assist with a PHP application, and we're reusing behave common.py functions and others - plus it's easier for the bulk of developers to understand testing using the common testing framework. Also I inherited it.
Learnings I've had:
Hostsfile
I've got some hosts specified in my hostfile
on my machine that map web addresses to my docker containers. To ensure that behave gets access to those hosts too, you pass through a network parameter:
1--network=host
Running a specific feature
I'm used to using behat
for PHP gherkin-style testing, which has a --feature
command line argument for running features. To run specific scenarios in behave, you have to give the scenario name:
1-n 'Delete those fractions'