Now Playing Tracks

Introducing BDDfire : An Instant Ruby-Cucumber BDD Framework


I am glad to announce ‘BDDfire‘ : An instant Ruby-Cucumber BDD framework which supports various popular open-source libraries like Capybara, Selenium-WebDriver, Poltergeist, Relish, Cuke_sniffer, Rubocop, Appium, Saucelabs, Browserstack etc etc.BDDfire will create all the directories and required files to support the latest open-source libraries in the Ruby-Cucumber framework.

BDDfire is a rubygems and we can install and use it in any brand new Cucumber project or existing Cucumber framework.

BDDfire source code is available on the Github. In this post, we will explore BDDfire in the detail.


BDDfire Features

Cucumber is a very popular BDD framework. Cucumber become more effective when it’s plugged with other open -source libraries. Sometime we miss most of the useful libraries to be used with Ruby-Cucumber. BDDfire supports lots of modern open-source libraries  so that we won’t miss new trends in the world of Ruby-Cucumber.

BDDfire has following features:

  • BDDfire will create template directories and files for the Cucumber project.
  • Capybara and WebDriver Integration for executing acceptance scenarios in the real browsers
  • Capybara and Poltergeist integration to execute scenarios in the headless browsers.
  • Generate template directories to support RSpec
  • BDDfire supports cuke_sniffer and Rubocop libraries which detect smell in the Ruby-Cucumber framework.
  • BDDfire supports Relish for the living documentation.
  • Rakefile has been automatically created as a part of BDDfire
  • BDDfire  supports YARD documentation of the cucumber project.

BDDfire Installation

With BDDfire, you can install Ruby-Cucumber BDD framework with all those libraries in a single command.

$ gem install bddfire

Or  include BDDfire in the Gemfile

gem 'bddfire'

Once installed we can make use of the BDDfire in our existing project. BDDfire commands will be listed when you run ‘bddfire’

$ bddfire
  bddfire fire_cucumber   
  bddfire fire_rspec     
  bddfire generate_yard  
  bddfire help [COMMAND]  
  bddfire version

The commands will look like this in the terminal.


BDDfire Usage

Now that, we have installed BDDfire. We need to create Ruby-Cucumber framework and make use of it.

Generate & Install Ruby-Cucumber Framework

BDDfire will install entire Ruby-Cucumber BDD framework in a single command

$ bddfire fire_cucumber

This will create all the directories and the files with required code in it. This will create Gemfile and Rakefile if they are not already in the project. Th typical output will look like this :


Now that we have got new Gemfile. We need to install bundle to get the dependencies installed on our project.

$ bundle install

This will create a ‘Gemfile.lock’ file. Now our Ruby-Cucumber Framwork looks like this


Using Selenium-WebDriver

Now we have installed ‘Selenium-Webdriver‘ and in the cucumber.yml file, we have selenium as a ‘default’ profile. We can execute our scenarios using

$ bundle exec cucumber

Using Headless Poltergeist

Poltergeist is the headless driver for the Capybara. We have created a profile for the Poltergeist in the cucumber.yml. Poltergeist execute scenarios in the headless browser based on PhantomJS

$ bundle exec cucumber -p poltergeist

Using Relish

Relish allows us to push feature file online as a living documentation. We have already got ‘.relish’ file in out BDDfire framework. We need to get relish api token. You need to have relish account and project created in the relish. Please use my previous blog to setup Relish.

Now you can push all the features to relish :

$ bundle exec relish push {Publisher}/{project}

Using Cuke_Sniffer

Cuke_Sniffer is a library which detects smell in the cucumber project. You can refer previous blog about cuke_sniffer to get detailed installation and usage.

$ bundle exec cuke_sniffer

Using Rubocop

Rubocop is the library to detect smell in the Ruby code. We have installed rubocop can be executed like this :

$ bundle exec rubocop

Using Saucelabs Or Browserstack

Saucelabs and Browserstack are the cloud testing framework. You need to have Saucelabs/Browserstack account and API key to use it. We have Capybara driver register ‘features/support/env.rb’. We need to add Saucelabs/Browserstack related details.

$ bundle exec cucumber -p browserstack


 $ bundle exec cucumber -p sauce

Using Appium

Appium is a very popular mobile test automation framework. You can refer my previous post to more about Cucumber-Appium setup. Make sure you have required setup before using Appium. Here we have ‘package.json’ file. You need have NodeJS installed so that we can install Appium

$ npm install

This will install Appium in the ‘node_modules’ directory. We can then start Appium Server.

$ ./node_modules/.bin/appium

Now that we can run cucumber cucumber

$ bundle exec cucumber -p appium

Using Rake Tasks

BDDfire creates some rake tasks by default. We have a Rakefile which has three tasks. Rake task ‘features’ will execute all the features with selenium deiver. Rake task ‘ cuke_sniffer’ and ‘rubocop’ execute bundles for relevant libraries.

$ bundle exec rake features
$ bundle exec rake cuke_sniffer
$ bundle exec rubocop

CI Integration

Currently, you can use the script ‘ci_script’ on Jenkins or Hudson. You need pass rake rask to the script

$ ./ci_script features

Contributing to BDDfire

I bet, you have better ideas to contribute to BDDfire. You can fork the repo on the github. Things to do are

  • Adding pre-defined steps for the Poltergeist and Selenium Driver. User will utilise step_definitions from BDDfire.
  • Adding steps for Appium
  • And many many things

Video Demo

The post Introducing BDDfire : An Instant Ruby-Cucumber BDD Framework appeared first on BDD Test Automation & Open-Source Tools.

via BDD Test Automation & Open-Source Tools

Sleipnir: BDD for the Apple’s new Swift


Apple has announced new programming language at WWDC 2014 called as ‘Swift’. Apple will keep both objective C and Swift to support application development. Swift seems awesome, you can watch the introductory video of the swift to know more about Swift.


Sleipnir: BDD for the Swift

As soon as Swift comes in, there is BDD framework developed by the guys at railsware.[@railsware]. Thank you so much. There is a blog post about ‘BDD-style testing in Swift with Sleipnir

There is code available on the GitHub for the ‘Sleipnir

BDD-style framework in Swift
6 forks.
0 open issues.
Recent commits:

Can’t wait for the release of OSX Yosemite and xCode 6 to get started Swift and Sleipnir.


The post Sleipnir: BDD for the Apple’s new Swift appeared first on BDD Test Automation & Open-Source Tools.

via BDD Test Automation & Open-Source Tools

RESTful API Testing with Behat and Guzzle

Behat and Guzzle

Behat is a behaviour driven development framework for the PHP application. Behat can be used for acceptance testing and api testing.

Guzzle is PHP HTTP client to work with HTTP and web services. You can read more about Guzzle on the official website . We can use combination of the Behat and Guzzle for the testing of the REST API. In this post, we will see how to use Guzzle http  for testing GitHub web services.

Behat in Action

Let’s do some action now. We will install behat, create feature simple file and implement step definitions.

Installation & Config

Let’s create our composer.json to install all the dependencies with composer.

$ mkdir RESTful-Behat
$ cd RESTful-Behat
$ vim composer.json 

    "require": {
        "behat/behat": "2.4.0",
        "guzzle/guzzle": "2.4.*",
        "guzzlehttp/guzzle": "4.*"
    "config": {
        "bin-dir": "bin/"

Now, we need to download composer and install all these dependencies

$curl | php
$php composer.phar install

This will install all the dependencies in the ‘vendor’ directory. Now we will create config file for behat.

# behat.yml

Note, we have created basic config for the behat. Now initialise Behat so that, Behat will create ‘bootstrap’ directory and ‘FeatureContext.php’ file.

$ ./bin/behat --init

Create Feature file

In order to test the GitHub’s REST API with Behat, we need to create a feature file in the plain english. Our feature file should look like this:

$ vim github_rest_api.feature

Feature: GitHub RestFul Api Testing with Behat  

 As a behat user
 I want to test restful api of the GitHub
 So that it will bring smile for behat community

Scenario: GitHub behat Demo Api 
  Given I request "/repos/Shashikant86/BehatDemo" 
  Then the response should be JSON
  And the response status code should be 200
  And the response has a "name" property
  And the "name" property equals "BehatDemo"

As we read the feature file, we can understand that we are checking response format, response code and properties of the response a.k.a response body. At this point, we need to run ‘behat’ to get undefined steps. We need to implement these steps in the ‘FeatureContext.php’ file.

Step Definitions

Now, it’s time to implement step definitions using all the methods of the Guzzle Http library.

$ vim features/bootstrap/FeatureContext.php


use Behat\Behat\Context\ClosuredContextInterface,
use Behat\Gherkin\Node\PyStringNode,
use GuzzleHttp\Client;     

class FeatureContext extends BehatContext
    public $_response;
    public $_client;
    private $_parameters = array();
     * Initializes context.
     * Every scenario gets it's own context object.
     * @param   array   $parameters     context parameters (set them up through behat.yml)
    public function __construct(array $parameters)

        $this->_parameters = $parameters;
        $baseUrl = $this->getParameter('base_url');
        $client = new Client(['base_url' => $baseUrl]);
        $this->_client = $client;

    public function getParameter($name)
        if (count($this->_parameters) === 0) {
            throw new \Exception('Parameters not loaded!');
        } else {
            $parameters = $this->_parameters;
            return (isset($parameters[$name])) ? $parameters[$name] : null;

     * @When /^I request "([^"]*)"$/
    public function iRequest($uri)
        $request = $this->_client->get($uri);
        $this->_response = $request;

     * @Then /^the response should be JSON$/
    public function theResponseShouldBeJson()
        $data = json_decode($this->_response->getBody(true));
        if (empty($data)) { throw new Exception("Response was not JSON\n" . $this->_response);

     * @Then /^the response status code should be (\d+)$/
    public function theResponseStatusCodeShouldBe($httpStatus)
        if ((string)$this->_response->getStatusCode() !== $httpStatus) {
            throw new \Exception('HTTP code does not match '.$httpStatus.
                ' (actual: '.$this->_response->getStatusCode().')');

     * @Given /^the response has a "([^"]*)" property$/
    public function theResponseHasAProperty($propertyName)
        $data = json_decode($this->_response->getBody(true));
        if (!empty($data)) {
            if (!isset($data->$propertyName)) {
                throw new Exception("Property '".$propertyName."' is not set!\n");
        } else {
            throw new Exception("Response was not JSON\n" . $this->_response->getBody(true));
     * @Then /^the "([^"]*)" property equals "([^"]*)"$/
    public function thePropertyEquals($propertyName, $propertyValue)
        $data = json_decode($this->_response->getBody(true));

        if (!empty($data)) {
            if (!isset($data->$propertyName)) {
                throw new Exception("Property '".$propertyName."' is not set!\n");
            if ($data->$propertyName !== $propertyValue) {
                throw new \Exception('Property value mismatch! (given: '.$propertyValue.', match: '.$data->$propertyName.')');
        } else {
            throw new Exception("Response was not JSON\n" . $this->_response->getBody(true));

We have implemented all the steps to test GitHub REST API. At this point, we will see all the steps has been passing



The source code for this demo is available on the GitHub at ‘RESTful-Behat‘ repo. You can try this by yourself

 $ git clone
 $ cd RESTful-Behat
 $curl | php
 $php composer.phar install


Watch video demo of this demo on youtube


The post RESTful API Testing with Behat and Guzzle appeared first on BDD Test Automation & Open-Source Tools.

via BDD Test Automation & Open-Source Tools

FootBall Fever Mac Setup

FIFA Fever

FIFA world cup 2014 is going on in the Brazil and whole world is affected with football fever. Being big fan of the England football, I have setup my home and my Macs to fully support England. Unfortunately, England team wasn’t lucky enough to qualify but I have decorated our home with England flags.

Mac Setup

 You can watch more pics on my tumblr post.

Mac Hardware

Hardware has following

  • Two MacBook Pro 13″

One  with Mountain Loin  and other with OSX Mavericks.

  • JVC 40TW51JD Smart 40 ” LED TV [HDTV]

JVC HDTV  connected to the BT Home Hub 4 with an ethernet cable.

  • HDMI Cable

Belkin Mini DisplayPort  can found in any Apple Store.

  • iPhone 4S

To take pictures of the setup.

  • BT HomeHub 4 /Wireless Phone

Wireless and ethernet network.

  • Ethernet Cable, Tables and England flags

This is my home setup. I use this Apple gear for programming, blogging, watching live TV stream from internet and using social Media. Being a software professional, I use many latest open-source development/testing tools from terminal/iTerm so big screens would be helpful. This setup helped me in

  • Watching my favourite TV programmes on BBC especially Sports Football, Tennis, Snooker etc
  • Blogging
  • Easy Switch between TV and HDMI content.
  • Full Audio supports from HDTV to watch offline matches.

Favourite OSX Apps

There are many cool OSX apps available on the Apple Store.

  • xCode

xCode is used for the mobile app automation xCode with command line tools can easy many setup used for RubyGems. I installed xCode with command like tools read more about it here.

  • Jenkins

Jenkins is a open-source continuous integration server. I have downloaded OSX version of the Jenkins. Read my blog to know more about Jenkins setup

  • iTerm2

iTerm2  is the terminal replacement for the Mac OSX. iTerm 2 has lots of cool feature over terminal.

  • Sublime Text

Sublime  is a popular editor the web developers.  You can down load Sublime Text 2 for the OSX from the website.

  • Atom

Atom  is another open-source editor developed by Github. Atom has various packages in order to support web development process. You can download Atom for OSX from the download link. I have installed Atom editor on Mavericks

  • GitHub

GitHub app can be found on the OSX Apple Store. Web developers can then clone, commit, fork code from the GitHub App. It’s very handy.

  • Alfred

Alfred  is a productivity app for the Mac OSX. You can use it as alternative to spotlight. You can find Alfred on the Mac Apple Store.

  • Pocket

Pocket  is very useful for the bookmarking the web content so that we can read it later. You can also find Pocket app on the Mac Apple Store.

  • Vagrant

Vagrant  is a cool way to create a development environment on the fly. Developers can create virtual machines for the web development.

  • Quick Time Player

Quick Time Player is a simple way to record screencast.

  • The Next Web

The Next Web   and Mashable  are awesome app in order to know latest trends in the technology and social media. Both The Next Web and Mashable apps are available on Mac Apple Store.

Productivity Tricks

Some of you might know these tricks but I enjoy these tricks.

  • Change Application icons

I like to change the application icons of Mac OSX. I used to download OSX icons in the .icns format and replace it with the existing one. The idea is very simple, you just right click on Application—>Show Package Content —> Contents—> Resources. You should find existing .icns file here and you have to replace it with new one. That’s it ! 

  • Rename iTerm tab

Being a web developer everybody uses command line tools like terminal or iTerm 2. It would be better idea to name each tab of iTerm with the specific name. It can be easily done with ‘cmd+I’ and then type name of the tab and then press escape. Read my detailed blog  

Enjoy Football, Enjoy Mac OSX !

The post FootBall Fever Mac Setup appeared first on BDD Test Automation & Open-Source Tools.

via BDD Test Automation & Open-Source Tools
To Tumblr, Love Pixel Union