What is Gauge?
Gauge is a lightweight, cross platform test automation tool developed by Thoughtworks (creator of Selenium and Twist). It is open source and promotes the concept of living/executable documentation. It facilitates collaboration between developer/client/analyst/ tester, guides development, runs automated tests and effectively describes the system. Essentially, it is an enabler for BDD. The idea is to specify behavior without dictating implementation. Gauge is similar to Cucumber, another popular test automation tool, the difference being that the syntax appears to be more natural than with Cucumber.
How does it work?
Business analysts/testers are able to capture requirements easily, using plain-speak/ordinary business language. The "Given, When, Then" approach usually associated with BDD, is not enforced. Requirements can be written in business readable language, specific to a domain.
Specifications and scenarios are used. These are written using a simple powerful syntax, Markdown. A specification contains a set of scenarios. Each scenario contains one or more steps. The step is then mapped to a code block. The code block can be written using any language/testing framework of your choice.
The tool can be used from the command line or within an IDE. There is support for the commonly used IDEs (Visual Studio, Eclipse, IntelliJ IDEA), as well as various plugins which provide intellisense, auto completion etc.
Figure 1: Example of a specification
Figure 2: Example of step implementations (Note: Steps are mapped to a code block using the [Step] attribute)
Figure 3: Tests run through Test Explorer
I have created a basic test project (i.e. not pretty). It is a book listing application, which provides a static list of books and allows the user to search for a book. Using a combination of Gauge, NUnit and Selenium, I have created a few specs and scenarios to demonstrate the basic functionality of Gauge.
The test project can be found here.
- Easy to install and set up.
- Integrates well with Visual Studio. The intellisense/auto complete support is useful. Missing step implementations are identified and added.
- Using gauge from the command line is straight forward.
- Specifications can be set up quickly. Markdown is simple to use.
- I like that there isn't a structure that is imposed on me. It allows for more natural, intuitive documentation.
- This could effectively be used as official project documentation, since the .spec files are straight forward to read and less code-like.
- Gauge makes it possible for behavior to drive the development process. It encourages you to focus on business value.
- I like the fact that I am able to pass in test data using text files, csv or table parameters quite painlessly.
- It seems quite comprehensive - datastores allow for reuse within each scenario, specification or suite of specifications; test fixture setups [BeforeSuite] and tear downs [AfterSuite] can be used as well; tests can be filtered and run based on tags; concepts allow for the reuse and grouping of common steps. List of features can be found here.
- I struggled to find tutorials and detailed documentation/forums supporting Gauge.
- Since there is no test structure that is prescribed, consistency could be an issue. I think it's important for a team to decide on the test structure upfront.
In summary, Gauge is a pretty cool tool to facilitate collaboration, BDD and test automation. Based on reviews, it seems that it fairs quite well for more complicated project requirements. It is definitely worth trying out.