Edit

Overview

Gauge is a free and open source framework for writing and running acceptance tests. Some of the key features of Gauge that makes it unique include:

What is a Specification?

Gauge specifications are written using a Markdown syntax. For example

# Search the Internet

## Look for something
* Goto Google's home page

In this specification Search the Internet is the specification heading, Look for something is a scenario with a step Goto Google’s home page

What is an Implementation?

You can implement the steps in a specification using a programming language for example

step("Goto Google's home page", () => {
  goto("google.com")
});

The Gauge runner reads and runs steps and its implementation for every scenario in the specification and generates a report of passing or failing scenarios.

# Search the Internet
## Look for something  ✔

Successfully generated html-report to => reports/html-report/index.html
Specifications:       1 executed      1 passed        0 failed        0 skipped
Scenarios:    1 executed      1 passed        0 failed        0 skipped

Note

The examples in this article use Gauge specifications with JavaScript and Taiko, a node js library for automating browsers (Taiko). However Gauge supports writing step implementations in Java, C#, Python, Typescript and Golang. You can use also use any driver like Selenium or Appium while implementing your steps.

Re-using Steps

Gauge helps you focus on testing the flow of an application. Gauge does this by making steps as re-usable as possible. With Gauge, you don’t need to build custom frameworks using a programming language.

For example, Gauge steps can pass parameters to an implementation by using a text with quotes.

# Search the internet

## Search Google
* Goto Google's home page
* Search for "Cup Cakes"

The implementation can now use “Cup Cakes” as follows

step("Search for <query>", (query) => {
  write(query);
  press("Enter");
});

You can then re-use this step within or across scenarios with different parameters

# Search the internet

## Look for cakes
* Goto Google's home page
* Search for "Cup Cakes"

## Look for movies
* Goto Google's home page
* Search for "Star wars"

Or combine more than one step into concepts using the .cpt file format

# Search Google for <query>
* Goto Google's home page
* Search for <query>

The concept, Search Google for <query> can be used like a step in a specification

# Search the internet

## Look for cakes
* Search Google for "Cup Cakes"

## Look for movies
* Search Google for "Star wars"

Data-Driven Testing

Gauge also supports data driven testing using Markdown tables as well as external csv files for example

# Search the internet

|query    |
|---------|
|Cup Cakes|
|Star wars|
|Pies     |

## Look for things
* Search Google for <query>

This will execute the scenario for all rows in the table.

In the examples above, we refactored a specification to be concise and flexible without changing the implementation.

Other Features

This is brief introduction to a few Gauge features. Please browse through rest of the documentation for features like

Head over to the installing Gauge section to try out all it’s features.