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.

By Dan Course

Senior Instructional Designer. Partnerships, people, products, delivery, agile tech and online edu. Naturally curious, innovative and willing to challenge the status quo.

%d bloggers like this: