How to use Behat and Phantom JS on Circle CI or Travis CI

A few months ago, I started working on some behavior tests for a javascript heavy website. I chose to write the tests in Behat, and wanted to use the Phantom JS driver because it would be faster than running Selenium 2 with a real browser. It also had to run on Circle CI. Once I got this working, several people asked for help getting theirs working, and some were using Travis CI. I threw together this demo repository which has a walkthrough of all the steps you need to follow to get these tools working together on either CI service.

Behat & PhantomJS: An example of using the Behat Selenium2 Mink Driver to power PhantomJS, and integrate with both CircleCI and TravisCI

Please let me know if this helps you, or if you have any questions!

Do you need testing help?

Last month, I posted this tweet offering up testing help for any PHP open source project. If you’d like to take advantage of this, just ask! Send me a tweet, ping me on github, or let me know below: