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

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

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

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

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

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}