Over a million developers have joined DZone.

Behavior driven development: Generating Groovy EasyB Story with Selenium IDE

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Opinions expressed by DZone contributors are their own.

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 }}