The Invincible A personal archive of software, founder life, travel, and the occasional detour.
Code Snippets

Behat Shortcuts

Run all

bin/behat path_to_yml

 

Run single feature

bin/behat features/featureName.feature

 

Run single scenario within a feature
Where 10 is the line number of the first line of the feature

bin/behat features/featureName.feature:10 

 

Run all tests with a certain tag

bin/behat --tags @tagname

 

All tests except a certain tag

bin/behat --tags ~tagname

 

Run multiple tags:

bin/behat --tags "@tagname1,@tagname2"
bin/behat --tags="@tagname1&&@tagname2"

 

Run tests tagged with @tagname1 AND @tagname2 AND NOT @tagname3

bin/behat --tags "@tagname1&&@tagname2&&~@tagname3"

 

By adding an @javascript tag above the feature (for all the scenarios) or above a single scenario, the test will use Selenium and Firefox to run the test. These defaults can be changed in the behat.yml file.

Related

More posts like this