Listings for "Agile ALM for Java Developers," Java Magazine, November/December 2011


Listing 1
package alm

import org.specs2._
import matcher.ThrownExpectations
import specification.Step
import Thread._
import org.openqa.selenium.WebDriverBackedSelenium

class Selenium2 extends Specification with ThrownExpectations {

  lazy val selenium = new WebDriverBackedSelenium(new org.openqa.selenium.firefox.FirefoxDriver(), "http://www.hotbot.com/")

  def is =
  sequential                                                       ^
    "This specification smoke tests HotBot search"                 ^ 
     Step(() => selenium)                                          ^
    "Enter search token and check the title of the SERP"           ! acc^
     Step(selenium.stop())                                         ^
                                                                   end
  def acc = {
    import selenium._
    open("/")
    `type`("search-Input", "Agile ALM")
    click("search-Submit")
    getTitle() must startWith("Agile ALM")
  }
}


© Oracle, 2011