I am new to Geb and Groovy but I have pretty good experience with Selenium 2.0 Automation framework.
Due to some requirement I need to move to Geb. Framework should have Gradle as build tool, Spock to run tests, Groovy as scripting language and Geb.
I went to Geb's official website and saw this piece of code
import geb.Browser
Browser.drive {
go "http://myapp.com/login"
assert $("h1").text() == "Please Login"
$("form.login").with {
username = "admin"
password = "password"
login().click()
}
assert $("h1").text() == "Admin Section"
}
but running it doesn't open a browser. Where we are defining browser instantiation like we do in Java: driver = new FirefoxDriver();
My questions are:
- What is the structure of project?
- How to write
setup()i.e. browser instantiation andteardown()i.e. browser instantiation and quitting methods in Groovy? - How to run tests using Spock?
Edit: This is the structure of one example project I downloaded from https://github.com/geb/geb-example-gradle
Where in here we have the setup() and teardown() method, which initializes the driver and quits the browser? Basically a BaseClass that has all initialization and other classes extending it?
