Why Do Most UI Test Automation Fail? (Part 2: Wrong Choice of Test Syntax Framework)

Chose the wrong Gherkin BDD frameworks. Should have used simple RSpec or xUnit (spec style)

Zhimin Zhan
7 min readApr 13, 2021

--

Updated (2023–05–05): “Cucumber is Dying”, What did we learn?

What is a test syntax framework?

Automation (also known as Driver) frameworks drive the application’s UI; test syntax frameworks provide the test structure and assertion mechanism.

Have a look at the below test script.

The highlighted (in light yellow) are test steps (or fragments) of an automation framework, in this case, Selenium WebDriver. The rest is provided by the test syntax framework, in this case, RSpec. Line 15 is an assertion step.

The granddaddy of the test syntax frameworks is JUnit created by Kent Beck and Erich Gamma in 1997. As its name suggests, it is designed for unit testing. With JUnit-style frameworks being widely used, JUnit variants were created for integration and functional tests as well.

How could a test syntax framework ruin test automation?

The test syntax framework, as shown above, is very simple as it should be. Some might wonder how a syntax framework could ruin test automation? The answer is Gehkin (so-called Behavior Driven Driven) frameworks.

First of all, BDD ≠ Gherkin. The first and most popular BDD framework is RSpec (2007), the “BDD framework for Ruby”. I think RSpec has just enhanced xUnit (in Ruby of course) to offer more non-programmer-friendly syntax. In my opinion, it was RSpec that made Behaviour Driven Development (BDD) popular. For example, you will find Mocha (in JS) is quite similar to RSpec.

Behaviour Driven Development (BDD) has been a hot term in recent years and has been introduced to software testing…

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.