The Relationship of Behavior with Test Automation(BDD, Gauge)

Numanhan Duran
4 min readDec 12, 2021

Hello everyone. In this series, I will talk about how to make test automation in BDD format using Gauge framework, how to code our scenarios using Gauge. In this article, I will talk about BDD and Gauge basically. In the other parts of this series, which will consist of two or three articles, I will try to code a few sample test scenarios. If our tea is ready, let’s start.

Behaviour Driven Development

What is this BDD(Behaviour Driven Development)

BDD stands for behavior-oriented development. It is a derivative of test driven development but tests are mainly based on system behavior. Test-driven development asserts some conditions, while behavior-driven development is written in plain text using real-time examples of real requirements to explain the behavior of the system. In this way, we create an up-to-date document of the application with these texts.

BDD has an easy writing method. Test scenarios are set up under three headings as Given-When-Then. Given, the test scenario we have determined is included in this title. When contains the plot, the time when the test case will happen. Then, tells us how the application will give a result after the determined scenario and flow. Our aim here is to address the behavior of the system by supporting behavior-oriented development. In this way, thanks to the document we will create, we will have a document about the behavior of the whole system, including the user behavior.

If we give an example of the scenario of a user withdrawing money from an ATM in BDD format;

  • Account balance 200€ (Given)
  • Card in working condition (And)
  • Sufficient balance available at ATM (And)
  • Account holder wants to withdraw 50€ (When)
  • ATM should give 50€ (Then)
  • 150€ must remain in the account(And)
  • Return Card (And)

Gauge and Test Automation

Gauge framework is an open source and free framework published by ThoughtWorks. It allows you to write legible and maintainable tests in preferred languages.

Terms such as step, spec and concept (cpt) are used when automating the test scenarios we write. Gauge is readable, quickly understandable and provides great convenience for rapid business development and test run in terms of writing. It is beneficial for us to be called with the names we give in the format of daily speech and to have an operation and even someone who does not know programming understands when they read it.

What Languages and Plugins Does Gauge Support?

  • Command line support that simplifies integration with CI-CD tools.
  • Language Support: Java, C#, Ruby, Javascript, Golang and Python
  • IDE Support: Intellij IDEA, Visual Studio Code and Visual Studio
  • Report Support: You can get your test reports with reporting support such as HTML Report, XML Report, JSON report.

Gauge Setup for Mac, Linux and Windows

While developing with Gauge, I use Java language. If you are going to use java in your own environment when installing Gauge, the JDK must be installed. I prefer Intellij IDEA for development environment.

On the Gauge site, how to install in windows, mac and linux environments is also mentioned step by step. (Gauge Installation)

MacOs Installation

  1. brew update
  2. brew install gauge

Linux Installation

1. First add the GPG key.

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-keys 023EDB0B

2. Then add the Gauge framework repository to the list

echo deb https://dl.bintray.com/gauge/gauge-deb nightly main | sudo tee -a /etc/apt/sources.list

3. We complete the Gauge installation with the following commands

  • sudo apt-get update
  • sudo apt-get install gauge

Window Installation

You must have made the necessary programming language installations. Below I will show you how to install Gauge on windows machine step by step with images.

In Chapter 1, I briefly talked about BDD and Gauge. To summarize, Gauge helps us to write test automation in BDD format and to have an idea about the operation and behavior of the system when an outside user reads the scenarios we write. In the next section, I will talk about how to create a Gauge project from scratch and its file structure. I hope it was a useful writing. I wish you a good day and good reading.. :)

Sign up to discover human stories that deepen your understanding of the world.

Numanhan Duran
Numanhan Duran

Written by Numanhan Duran

Software Test Specialist — Somewhere in Europe

No responses yet

Write a response