Over a million developers have joined DZone.

Behavior driven development: Generating Groovy EasyB Story with Selenium IDE

· Java Zone

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

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

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}