Behat-SauceLabs Integration on GitHub

17 Mar

Behat is a new generation Behavior Driven Development tool for PHP applications. Behat is inspired by Ruby’s Cucumber. Behat can be used for web acceptance testing by using Mink. Mink uses browser emulators like Selenium, Sahi, WebDriver to launch browser.

SauceLabs is cloud testing service which allow selenium based tests into cloud machine with different browser combination. Create an account with Saucelabs and you will definitely love it

To install and setup Behat project, read SauceLabs blog ‘Adding Sauce To Behat‘.

Let’s directly move on to code. I assume you have installed Behat and Mink as per the blog ‘Adding Sauce To Behat’.

You can use code available on GitHub project ‘Behat-Sauce‘ directly into your project.

Requirement:

*Behat/Mink Installed

*Ant

*SauceLabs Account (Username and API Key)

*Jenkins (optional)

How to use?

* Clone the repository from my GitHub

   
$ git clone git@github.com:Shashi-ibuildings/Behat-Sauce.git
$ cd /path to/Behat-Sauce 

* Edit ‘Sauce.yml’ file in order to specify your username and API key.

* Now, Run ANT command to execute feature on sauce Labs

   
$ ant runSauce 

* Once All tests executed see the reports generated in ‘report/report.html’ file.

*  Use it in your project by updating ‘behat.yml’ and ‘sauce.yml’. Change Base url to your application url.

* Write and implement features in ‘features’ directory.

You can setup your Jenkins Continuous Integration server by following the blog post ‘Adding Sauce To Behat’

Don’t invest your time/money and effort in setting up different machine/browser combinations for cross browser testing. Better to use SauceLabs.

Any questions? Let me know.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: