Jan 01, 2017 | Soumya Swaroop

Why we Test in plain text

Why write tests in plain-text?

Writing scenarios to test a functionality involves a lot of thinking. Over time test cases and scenarios become complex even for trivial applications.

Writing tests in plain text helps to keep it clear and simple.

As a team, both technical and non-technical members interact to gather feedback. Specifications written like a story enables all stakeholders to easily understand and verify intent.

I work on Gauge — an open source automation tool with the ability to author test scenarios and cases in business language.

While building Gauge, we looked at a lot of options to make it easy to author the test scenarios. Structured formats like fixture, HTML, XML, JSON and Gherkin didn’t suit our requirement. While Asciidoc, reStructuredText came close to expressing natural language we chose Markdown, as it was simpler and suited our needs.

The specifications can be authored using any simple text editor across platforms or Operating Systems. It’s great for productivity. It is intuitive and it gets to the core of what matters: ease of use.

In this post, I’d like to show you, how to get the most of Markdown with Gauge using a few examples.

Natural Language to create common understanding. Specifications in Gauge inherit Markdown’s readability.

For example

Separation of concerns of data and scenarios. Test data sets and scenarios can be easily separated and maintained using tables!

For example

With the test data and scenario steps separated, there’s flexibility to manage the test cases.

Flexibility to express intent. We can word the same functionality differently to set a context or express intent better.

For example

The following steps have the same underlying functionality.

They check for the system generated email. Gauge allows wording them differently without having to repeat the code block giving the user the flexibility to express.

Convey more with images. Visually enrich the test case reports by associating images.

For example

The generated html report will show the specified image after executing the specification above.

Abstraction code behind the steps. Markdown allows Gauge to abstract text from executable code blocks.

For example

The Gauge step to code journey can be iterative. The steps can be authored without code blocks. Gauge skips such scenario(s) until all its steps have an association to a code block. This makes building the test cases fast and easy.

Language Choice with UTF-8 character support. The Markdown’s UTF-8 character support enables you to write Gauge’s specifications in the language you actually like!

For example

Gauge is a free and open source test automation framework that takes the pain out of acceptance testing. Download it or read documentation to get started!

Why write tests in plain-text from r/getgauge