LambdaTest Community

Find answers, support, and inspiration from other users

LambdaTest Community

How can I perform automation testing with Gauge & Selenium framework?

Can anyone provide me a valid tutorial on how can I perform automation testing with Gauge & Selenium framework

Up Vote Down Vote 0 Votes
Posted 4 months ago


Gauge is a free open source test automation framework released by creators of Selenium, ThoughtWorks. Test automation with Gauge framework is used to create readable and maintainable tests with

languages of your choice. Users who are looking for integrating continuous testing pipeline into their CI-CD(Continuous Integration and Continuous Delivery) process for supporting faster release cycles. Gauge framework is gaining the popularity as a great test automation framework for performing cross browser testing.

This article would help you understand the benefits of using Gauge test automation framework, installing and running your first automation script for test automation with Gauge framework. I will also show you how to use LambdaTest Selenium grid for executing your automation script for test automation with Gauge framework to perform extensive, automated browser compatibility testing with Gauge on cloud. Here we go!

What Is Cross Browser Testing?

Cross Browser Testing is the process to validate the quality of the web application across different browsers, browser versions running on numerous operating systems to verify compatibility and behaviour of an application under test.

The browser differences are induced due to rendering engines. Each browser version has a unique engine responsible for representing the web elements in a different manner.

We have a plethora of platforms, browser, browser versions to test. It would be strenuous and probable infeasible to have all the browsers installed in your local system as you perform test on them one by one. Also, you can’t go ahead having a device lab of your own. So how would you perform cross browser testing in detail?

Why Choose Gauge For Cross Browser Testing Out Of Other Test Automation Frameworks?

Now, that we are aware of the basics regarding Gauge framework and cross browser testing. Let me tell you why I prefer to perform test automation with Gauge framework over other test automation frameworks.

  1. Wide range of templates are available in a language of your choice to have an easy kick start to the project.

  2. Command Line support which makes the integration easier with CI-CD tools.

  3. Test automation with Gauge framework supports all major programming languages along with GoLang.

  4. It supports wide variety of plugins, here is a list of all plugin categories available.

       * Language Runners: Java runner, C# runner, C# runner(.Net Core), Ruby runner, Javascript runner, Golang runner and Python runner.
       * IDE Plugins: Visual Studio Code, IntelliJ and Visual Studio.
       * Reports: HTML Report, XML Report, JSON Report, Spectacle and Flash.
       * Build Management: Maven and Gradle
       * You can even create your own plugin using their open source Gauge API.
  5. Quickly detect issues through screenshots of event failures and multiple reporting formats available instead of navigating through stack traces.

  6. Allows you to create scalable tests through parallel execution and being an open-source it offers integrations with cloud-based solutions like LambdaTest for addressing the cross browser testing goals.

  7. Better management of data sets through data driven testing with multiple data sets is possible while keeping specifications highly readable.

  8. Easy to 1. write effective test cases by members across the team.

  9. Automated cross browser testing made easy.

  10. Scalability of product requirements across the QA, Dev and Business teams.

Is Gauge Framework Meant For BDD(Behaviour-Driven Development)?

Users often tend to compare creation of spec files for test automation with Gauge framework is the same way as we develop feature files in BDD using Gherkin, believe me there is a lot of difference in between them.

  • Behaviour Driven Development focuses more on conversations, collaborations and automation in order to achieve the business needs, test automation with Gauge framework following Acceptance Test Driven Development focuses and emphasize more on functional testing.

  • Feature file in BDD is replaced by spec file for test automation with Gauge framework.

  • Feature file is created with Gherkin Language, Spec file is created using markdown language.

  • Test automation with Gauge framework provides templates for automation where BDD doesn’t depending upon the language.

Gauge has all the BDD features intact making BDD a subset of test automation with Gauge framework.

Installing & Setting Up Gauge For Your Operating System

Download the latest build of gauge from GitHub-Gauge. Depending upon the operating system, download the required binaries.

Installing Gauge Framework in Mac:

Installing Gauge framework in macOS using Homebrew with below commands:

1. brew update
2. brew install gauge.

Installing Gauge Framework in Linux using apt-get:

  1. Add GPG key with below command: sudo apt-key adv --keyserver hkp:// --recv-keys 023EDB0B
  2. Add Gauge framework repository to the list. echo deb nightly main | sudo tee -a /etc/apt/sources.list
  3. Install Gauge framework with below commands: sudo apt-get updatesudo apt-get install gauge

Installing Gauge Framework in Windows:

Complete the installation of required packages of programming languages. It works with all languages like JavaScript, C#, Java, Python and Ruby.

Extract it to a desired location and add it to system path.

Using CLI to get started with Project Creation for Gauge

To verify the version of the Gauge framework, open cmd and type command “gauge --version” as shown in the image below.

Step 1: Gauge framework has a list of project templates defined already for the language of your need. You can take a look at it by typing in command “gauge init --templates”.

Step 2: Navigate to a folder of your choice and create a java project using command “gauge init java”.

Step 3: To run the sample project and view report you can use the command “gauge run specs”.

As you can see the path to report generated in CLI(Command Line Interface), sample report generated for the test stub executed is as below.

Creating Your First Project Using Gauge For Test Automation

As we have made use of command line till now, for a better coding experience we can make use of IntelliJ IDE to create our first script. Start with creating a maven project with below information.

  • Navigate to File and select New Project.

  • Project Type as maven should be selected.

  • You need to select the below mentioned name:

  • “com.thoughtworks.gauge.maven:gauge-maven-plugin”

  • This would help you to generate an archetype.

  • If you don’t see the archetype mentioned above, add Archetype by entering below info.

  • GroupId: “com.thoughtworks.gauge.maven:

  • ArtifactId: “gauge-archetype-java”

  • After selecting the archetype, you need to click on next. By doing so, you will be providing the Artifact ID & GroupID for your respective maven project.

  • GroupId: com.thoughtworks.gauge.maven

  • ArtifactId: GoogleSearchProject

  • Version: 1.0-SNAPSHOT

  • Before you click on next for finishing the process, make sure that you verify the Maven settings thoroughly.

Once you have successfully created a project it would look something as below.

Running First Automation Script Using Gauge Framework With Selenium Grid

Step 1: Create a specification file for searching a keyword in google and if results are displayed as expected.

Specification heading in the specs file would be denoted with ‘#’ notation as defined in our project. Example: #Google Search Specification

Scenario would be defined using ‘##’ notation, quoting an example below for reference. Example: ## Searching google should return the name of the query.

Steps would be defined using ‘*’ notation. Example: * Navigate to ““. Spec file create for Google search is as below:

Google Search Specification

Searching google should return the name of query

  • Navigate to “
  • Enter query “query” in the search box and submit
  • The search results should show “LambdaTest” as a result

Step 2: Create a step implementation file, with below-mentioned code to define acceptance tests as defined in specification files.

package com.thoughtworks.gauge.maven;

import com.thoughtworks.gauge.Step;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;


import static org.junit.Assert.assertEquals;

public class StepImplementation {

public static WebDriver driver;

@Step("Navigate to")

public void navigateTo(String url) throws InterruptedException {

System.setProperty("", "C:\Users\Dexy\IdeaProjects\GaugeSampleProject\libs\chromedriver.exe");

driver = new ChromeDriver();




@Step("Enter query <query> in the search box and submit")

public void enterQuery(String queryL) throws InterruptedException {

WebElement searchBox = driver.findElement("q"));





@Step("The search results should show <Jupiter> as result")

public void verifySearchResult(String resultString) {

WebElement result = driver.findElement(By.className("LC20lb"));

assertEquals(resultString, result.getText());



Step 3: Execute the test case from the specification file created. Right click on the file and select option as shown in the image below. Browser specification could be provided in env folder’s file as

#Browser Usage BROWSER = CHROME

We can provide maven command to execute with conditions as below.

  1. To execute mvn gauge:execute

  2. To execute all specs: mvn gauge:execute -DspecsDir=specs

  3. For parallel execution: mvn gauge:execute -DspecsDir=specs -DinParallel=true

  4. Node specification during parallel execution: mvn gauge:execute -DspecsDir=specs -DinParallel=true -Dnodes=2

    Step 4: Once execution has been successfully completed you can verify the status of the test in the terminal.

Reports generated can be viewed in reports folder – GaugeSampleProject\reports\html-report

Source: How To Perform Test Automation With Gauge & Selenium Framework?

Up Vote Down Vote 0 Votes
Posted 4 months ago