Run all Behat tests and export results in a file
If you are using Behat in your development workflow, sometimes you probably need to run all the tests and would like to have a nice report in a file, unless outputted in the terminal screen.
Here is how you can do it:
First, let's create the file where all the errors are going to be registered:
$ touch my_behat_errors.txt
Second and last:
$ ./bin/behat --ansi --rerun=my_behat_errors.txt
If you'll have any failed scenarios and you'll run again the command, only failing scenarios from the file will be run.
If the file contains no scenarios, then all scenarios will executed.