Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Behavior driven development: Generating Groovy EasyB Story with Selenium IDE

DZone's Guide to

Behavior driven development: Generating Groovy EasyB Story with Selenium IDE

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

Are you an easyb user which would like to create story that run selenium's commands? You can let's Selenium IDE generate it for you instead of code it by your hand.

I try to google selenium and easyb, I couldn't found format of Selenium IDE to generate easyb story. So, I decided to create one myself for automated testing of grails project.

Below is the code generated for scenario of google search for "hello world" for your reference:

import com.thoughtworks.selenium.*
import java.util.regex.Pattern

before "start selenium", {
given "selenium is up and running", {
selenium = new DefaultSelenium("localhost",
4444, "*firefox", "http://www.google.com.my/")
selenium.start()
}
}

scenario "Enter scenario description here", {
then "Enter any description here", {
selenium.open("/")
selenium.getTitle().shouldBeEqualTo "Google"
selenium.type("q", "hello world")
selenium.click("btnG")
selenium.waitForPageToLoad("30000")
selenium.getTitle().shouldBeEqualTo "hello world - Google Search"
}
}

after "stop selenium", {
then "selenium should be shutdown", {
selenium.stop()
}
}

You can find out more information from the URL below:

http://limcheekin.blogspot.com/2009/07/behavior-driven-development-generating.html

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}