Gauge is a tool created by ThoughtWorks .Inc – pioneers of Selenium. It is a type of Behaviour Driven Testing process which enables innovators to accelerate their products and services onto the market. It is an efficient, lightweight, open source, cross-platform tool, with a built-in CLI, which we have been using successfully for sometime at Mitra Innovation.
Mitra Innovation likes to share knowledge and experience, and so we thought it would be helpful to not only explain what Gauge is, but also to show how it can be used (with a step-by-step guide), and how it can help accelerate the development of your own products and services.
Behaviour Driven Testing – The Background
Behaviour Driven Testing (BDT) is a lesser known companion of Behaviour Driven Development (BDD) – a software development process which combines the general techniques and principles of Test Driven Development (TDD), with domain-driven design and object-oriented analysis and design. The goal of BDT is a business readable and domain specific language that allows for a description of a system’s behaviour without detailing how that behaviour is implemented.
● BDT focuses on the business point of view and requirements of software rather than the technical implementation
● BDT encourages collaboration between developers, QA, and business participants, in an effort to help bridge the business/IT gap.
BDT has gained momentum as many organisations use it as a solution for automation and collaboration challenges. The BDT framework has been successfully implemented by various QA teams in various domains.
Behaviour Driven Testing and Gauge
Gauge is a particular type of open source Behaviour Driven Testing tool.The successful concept behind it is ‘Living and Executable Documentation’, i.e. a document that can be continually edited and updated.
● The documents/specifications are all written in Business Language – Markdown format
● It is useful and applicable to Agile based environments because stakeholders can review documentation to ensure that specifications describe the expected behaviour of the system from an end-user point of view
● It can include a complete set of specifications, with checks for correctness on each implementation.
Gauge also has a number of other useful features and benefits:
● Stakeholders can understand tests in text rather than in syntax
● It is open source and provides cross platform / languages support for writing test code
● It supports Data Driven Tests and helps to create maintainable test suites
● The automatic report generation and the ability to generate test specification documentation is very useful when it comes to test reporting and getting the sign off for the test cases from the customer
● HTML document generation
● Parallel test execution support which saves time
● Data Store Support – to share data in steps defined in different classes at runtime
● Tagged test execution which allows the running of specific tests providing tag(s) name in specs or scenarios separately (without running the entire tests), which is handy when running a regression test on a specific module after a bug fix.
Gauge can be used without a large amount of familiarisation and can be installed and initialised with a command. Additionally, it is not restricted to any certain Integrated Development Environment (IDE) or to a platform.
Here is an outline of a BDT process using the Gauge framework:
1. The Business Analyst identifies features the customer wants as User Stories
2. QA personnel pick User Stories and identify test scenarios
3. QA personnel writes Test Steps in behaviour driven Test Specifications using Gauge
4. QA personnel implements the underlying code.
5. Code is deployed and automated test cases get executed
6. Bugs get fixed, and set of automated tests run as regression tests
7. When complete, the customer accepts the software.
Gauge can also be integrated into the build tools Maven and Gradle and includes the two report plugins HTML report and XML report. Large quantities of test data can be read from text files, CSV and additional formats keeping the specifications readable.
Getting started with Gauge – Step-By-Step Guide and a Few Handy Hints and Tips
In order to understand (a) how BDT works using the Gauge tool, (b) the use of Gauge as an open source framework, and (c) how Gauge fits into an Agile environment, we’ve outlined an example below that you could follow as a developer.
The example also demonstrates the differences between traditional automation and BDT using Gauge.
The following example begins with a Login Screen.
First, you’ll need to identify Test Scenarios, then identify Test Cases and Test Steps. Depending on the Application Under Test (AUT), the number of scenarios may vary based on types of user roles, privileges etc.
The image below shows a specification (Login.spec) with three scenarios. It begins with the specification name and then scenario names.