Skip to main content

Running Geb Automation Tests On LambdaTest Selenium Grid

Based on Groovy, Geb is a web testing automation framework. It is build as a wrapper over Selenium WebDriver which makes it ideal for automated browser testing. Geb automation testing framework can help you automate cross browser testing over every browser that is supported by Selenium WebDriver. Geb automation testing framework offers excellent features for web testing, screen scraping, and more. What makes Geb unique is the way it queries your HTML pages, it does so by offering the jQuery-like syntax. Also, it provides built-in support for the Page Object pattern.

LambdaTest will help you to perform Selenium test automation with Geb framework on our online Selenium Grid of 2000+ real browsers to ensure your web application renders well on as many browsers as you are targeting to test. This topic will talk about the:

  • Prerequisites for running Geb test automation script on LambdaTest.
  • Executing first Geb automation script on LambdaTest.
  • Executing parallel testing using Geb automation framework on LambdaTest.
  • Executing automated browser testing on locally hosted web application using Geb test automation framework.

Prerequisites To Run Geb automation Scripts On Our Selenium Grid#

  1. Install Maven.

  2. Make sure you have Java installed in your system. We recommend installing Java 8 or above version for more stable execution.

  3. LambdaTest Authentication Credentials

    You will need your LambdaTest authentication credentials i.e. your LambdaTest username, access key and HubURL. You need to set them up as your environment variables. You can retrieve them from your LambdaTest automation dashboard by clicking on the key icon near the help button.

  • For Mac/Linux:
export LT_USERNAME="undefined"export LT_ACCESS_KEY="undefined"
  • For Windows:
set LT_USERNAME="undefined"set LT_ACCESS_KEY="undefined"
4. Clone LambdaTest [**GitHub repository for Geb framework**][5].

Executing Your First Geb Test Automation Script On LambdaTest#

Step 1: Navigate to the LambdaTest Geb cloned directory.

Step 2: Compile Maven dependencies. Using the below command.

$ mvn compile

Note: You may also want to run the command below to check for outdated dependencies. Please be sure to verify and review updates before editing your pom.xml file. The updated packages may or may not be compatible with your code.

$ mvn versions:display-dependency-updates

Step 3: Edit the capabilities.json file with the Desired Capabilities of your preference as shown below.

{"build": "GebFirstTest", "platform": "Windows 8", "browserName": "Mozilla", "version":"65.0"}

Note: If you wish to change the desired capabilities for your Selenium automation testing scripts then you can leverage our Desired Capabilitites Generator. The Capability Generator will help you with the syntactically correct Desired Capabilities class based upon your selections from the drop-down menus.

Step 4: Use the command below from the root of the project to run your tests.


Executing Parallel Testing With Geb Automation Framework#

You need to clone the LambdaTest Geb repository. To run your Geb test automation scripts in parallel over different browser testing configuration, you would need to add extra capabilities in your capabilities.json file. For example:

{"build": "GebParallelTest", "platform":  "Windows 8", "browserName": "Mozilla", "version":"65.0"}{"build": "GebParallelTest", "platform":  "OS X Yosemite", "browserName": "Chrome", "version":"72.0"}

After specifying the extra capabilities, you need to run the same command as you did for running your first script from the root of your project.


It will run the tests in your project with each of the configurations listed concurrently by configuration. i.e. all configurations will run at the same time. Individual test outputs will be routed to a log file named after the configuration in the project root folder.

==> {"build": "GebParallelTest", "platform": "OS X Yosemite", "browserName": "Chrome", "version":"72.0"}.log

Note: It may be useful to use a Java IDE such as IntelliJ or Eclipse to help troubleshoot potential issues.

Testing With Geb Test Automation Framework On Locally Hosted Web Applications#

LambdaTest offers a SSH(Secure Shell) tunnel to help you test your locally hosted web application on cloud servers hosted by us. We call it the LambdaTest Tunnel. Using LambdaTest Tunnel, you can establish a unique, private and reliable connections on our cloud machines and run your automation testing scripts.

To run your test cases on LambdaTest Tunnel, you would need to set the tunnel flag to true in our desired capabilities generator or you could simply add the below in your capabilities.json file.

{"build": "GebLocalHostTest", "platform": "Windows 8", "browserName": "Mozilla", "tunnel": true}

Kudos! That is all you need to know to learn Geb automation testing scripts on LambdaTest online Selenium Grid. In case you have an questions feel to let us know. You can drop a message to our 24/7 chat support, or you could mail them to us over [email protected]. Happy testing! ๐Ÿ™‚

Last updated on