Speed up your Behat testing workflow

So I’m really enjoying Behat and BDD so thought I’d share a cool tip which has sped up my writing test workflow using @tags.

When you need to keep re-running one of your tests you can use tags to make sure you’re only running one thing rather than a whole suite or the whole .feature file.

Basically, in the test you’re working on, add a tag @now

@now
Scenario: Student who has requested an Interview can Apply
When I follow "View"
Then so and so

Now run your test like so,

behat --tags now

It will only ever run that tagged test, so you’re not running loads of others and waiting around. Sometimes, it “feels” even faster to run,

behat --tags now -f progress

I know this may seem pretty simple, but I’m learning here and found this really useful.

Author: Dan Course

Dan Course, E-Learning Development at Warwick University (WMG). Agile Scrum trained and full-stack development. Interested in E-learning, Democracy, Politics and Tech. All thoughts are mine and not of my employer.