This is a project template to get you started quickly with automated browser tests using
- Geb (written in Groovy, uses Selenium)
- Maven
- TestNG (JUnit, Cucumber, Spock might be used as runner, too)
Latest versions as of 2017-12-02 are used.
- Geb supports DRY principle better than plain Selenium, reducing maintenance effort. Concepts of page and module ("tile") and other convenient stuff.
- Uses jQuery style selectors most developers already know
- Still allows for Selenium WebDriver API usage, if ever needed
Following features where added (compared to more naked Geb projects):
-
Google Chrome Browser
Ubuntu did fine with Chromium as well.
You could use -Dgeb.env to setup different browsers (Firefox, headless PhantomJS), see file GebConfig. Additional setup required to do so.
If you want to use a custom Chrome installation, set environment variable CHROME_EXECUTABLE (pointing to the executable) -
JDK 8
You can get it from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Version should be downgrade-able as well by changing pom.xml. We recommend IntelliJ IDEA (free community edition is sufficient) for its out-of-the-box TestNG and Maven support. And even some Geb support. Just click the green run triangle in an opened *Test class.
Nothing else!
If you get "could not connect to renderer" error but Chrome window has opened, you propably need to update the chrome driver (project root folder) with downloads provided at https://chromedriver.storage.googleapis.com/index.html . See ChromeDriverHelper to learn how OS and filename correlate.
Either of those:
- Open e.g. MyFirstTest in your IDE and execute (as TestNG test)
- Run 'mvn test' on command line (or 'mvnw test' if you dont have Maven installation yet). This will use TestNG suite defintion testng-default.xml
Technology | Example File |
---|---|
Geb | PlainGebScriptingExample |
Groovy | GroovyLearner |
- Set GebConfig.baseUrl to your actual baseUrl. Geb's homepage is pre-defined.
- Adapt MyFirstTest and MyFirstPage to your needs.
https://github.com/geb/geb-example-maven more naked geb example
http://gebish.org/manual/2.0/ Geb doc