Behat 2.2: Bunch of new features
Dec 13, 2011
Dec 14, 2011 − Yeehoo, it's here! Behat 2.2 is finally released and has amazing new features for you to play with. "Multiple formats output", "Output color settings", "Couple of new formatters" if this all means something to you - continue reading.
Yeehoo, it's here! Behat 2.2 is finally released and has amazing new features for you to play with. "Multiple formats output", "Output color settings", "Couple of new formatters" if this all means something to you - continue reading.
The biggest change since 2.1 is infrastructure migration. Now Behat uses Travis CI for its continuous testing. And i'm happy to announce that Behat and Gherkin are now parts of growing Packagist family. Yep, you can finally install Behat with this shiny new Composer thing.
Next in the line is the most requested feature from Behat users:
Multiple formats output
Ever wanted to use 2 formats at the same time? Here you are:
behat -f pretty,progress
Not too useful, right? Or is it???
Yep, you can provide multiple outputs too. Split both formats and outputs with
,. Empty outputs will be printed to stdout.
progress to console,
behat.html and junit to
xml folder command will look like this:
behat -f progress,html,junit --out ,behat.html,xml
Ever wanted to print your entire feature suite without executing any underlying code? Want to just print snippets without waiting suite to gets executed?
--dry-run to rescue:
--definitions always expects value to be providen, because it can print definitions in different styles:
- to just print list of definitions - use
- to print definitions with extended info - use
- to search for specific definition - use
-d 'search string'.
Want a list of failed scenarios paths? Here you are:
This formatter is also used internally by
This little helper prints only snippets without any other steps information:
And I went even further with
snippets formatter. Now you have magic
--append-snippets option. When used, this option makes Behat to automatically append snippets into your main context class. How cool is that?
Refactoring and other small features
There are even cooler small features in this release, but I will let you to discover them yourself ;-)
Starting from 2.2 Behat have a powerful plugin system, that could be used to extend/overhaul Behat internals.
BehatBundle needs to be updated in order to work with Behat 2.2. So if you're using BehatBundle in your project - just wait a little with upgrade ;-)
You like Behat but don't know how to start with it? Or you just need to explore Behat internals with its creators? Attend the first BDD/Behat training in Paris