End-to-end testing by combining scenarios from behavior-driven development

S. Lehner. End-to-end testing by combining scenarios from behavior-driven development. 5, 2020.

  • Susanne Lehner

Background Behavior-driven development (BDD) is an agile software development approach which uses a domain-specific language (Gherkin) to communicate business specifications (scenarios). These scenarios serve as automated acceptance tests and form a living documentation. The scenarios follow a Given-When-Then format and according to best practices the scenarios should be kept short and simple. With the BDD framework Cucumber these scenarios are then executed against the application under test. Each step matches with a step definition which is the implemented automation code for this step.

Objective The main focus of this bachelor thesis is to find a way to use such scenarios to create bigger scenarios for end-to-end testing. The goal is to find out what changes need to be done in order to be able to combine such best practice BDD scenarios. This is done through a comparison of best practice scenarios and the new combinable scenarios. This comparison leads to some rules that have to be followed to make such a transformation possible.

Method For an example project a few main features and scenarios were identified. In a first step, these scenarios were developed following the best practices. By using these scenarios as a basis, in a second step scenarios that can be concatenated to end-to-end tests were developed. Furthermore, a comparison of both approaches allowed to identify the necessary changes.

Results As a result of the comparison of the two approaches, some guidelines for creating BDD scenarios for end-to-end testing are defined. By applying these guidelines the newly created scenarios can be concatenated and executed successfully.

Conclusions Best practice BDD tests and combinable tests are different in terms of the way they are written. Combinable scenarios have to follow some naming conventions in order to ensure the possibility of concatenation. Furthermore, it is necessary to keep a global state of the system to verify the state within the execution of the steps.