Archive for BDD

BDD using easyB, Selenium and Groovy by Rajiv Narula

Posted in Uncategorized with tags , , , , , , on January 12, 2012 by javaforweb

Today I got an opportunity to attend a session over BDD using easyB and Selenium.
Scripting language – Groovy.

It was “def test = new BDDMadeEasy(Selenium,EasyB,Groovy)” by Rajiv Narula.

Rajiv is an Associate Director with Perceptive Informatics having 15 years of experience in dev, architectural road map, laying automation strategy etc.

This was my first appearance in a MeetUp group and I can say I am satisfied with my decision.
I knew some hands on stuff over Groovy and few things about JBehave like writing stories etc..

I would like to share my take aways from the Session.

In Rajiv’s words

BDD ( Behavior Driven Development ) is a way that can let 3 Amigos – BAs, Developers and Testers collaborate.
Software artifacts/documents like Requirement Specs, Use Cases, functional specs, flow charts, stories etc can be used to describe the content of the software but But “How software will behave under specific condition?? ” none of them answers it.

BDD gives an answer to “How should a software will work under specific situation.”

BDD offers a template for defining behavior.

Template :-

Given Some precondition (Pre-conditions)

Some Action by actor (Steps)

Then some testable outcome is achieved (Expected Behavior)

Similar way we can have multiple conditions.

A Use Case can be defined as a set of scenarios and easyB scripts allow us to write stories that can implement those scenarios in a beautiful way thus giving a common platform to the Business Analyst and Tester to working on same ground.

Writing stories in easyB

writing stories… in easyB script

description “As simple as it gets”

scenario “Testing easyB setup”

given “there is some precondition”, {
myList = new ArrayList()
when “some steps are performed”, {
myList.add(‘Hello easyB’)
then “results can be validated”, {
myList.size.shouldBe 1


description, scenario, given, when and then are KEYWORDS. A business analyst can understand statements written in “” eg. “there is some precondition” and an Automation Tester can actually write automation code/test script with in {}e.g. { myList = new ArrayList() }

Greater Boston Selenium Users Group

Another example –


description “”

scenario “search on google”, {
given “machine is connected to internet”

when “Search Rajiv on google” ,
{“/search?q=rajiv narula”)

then “google result should bring something”, {
selenium.isTextPresent(“rajiv narula”).shouldBe true

So here a layer is written that will interpret this story file and execute it giving the excution results in the simple Story based format.
These results can be generated in the HTML or any other format.

There are many things we can achieve through easyB like prioritizing the test cases using Tags, parallel script execution etc.
To be frank I would like to learn more about BDD and tools like JBehave with selenium or RSpecs and Cucumber.

Though I personally had a feel that its a better way to let a BA and Tester work together and a way through which application behavior can be tested based on   requirement specifications.

Here are some of the useful links to learn BDD :-

JBehave and Selenium :-

RSpec and Cucumber :-