BDD using easyB, Selenium and Groovy by Rajiv Narula

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.
http://www.rajivnarula.com

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 -

ThisIsSampleStory

description “”

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

when “Search Rajiv on google” ,
{ selenium.open(“/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 :-

http://blog.m.artins.net/acceptance-tests-with-jbehave-selenium-page-objects/

http://jbehave.org/reference/web/stable/using-selenium.html

http://siark.wordpress.com/2010/10/01/behaviour-driven-development-with-jbehave-web-3-selenium-and-maven-2-on-os-x-snow-leopard/

RSpec and Cucumber :-

http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/

About these ads

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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: