bdd-dsl

Logo

Metamodels and associated toolings for applying Behaviour-Driven Development (BDD) to test robotic scenarios.

View the Project on GitHub hbrs-sesame/bdd-dsl

Metamodels for Specifying BDD Scenarios for Robotic Applications

Metamodel Design

Quick Review of Behaviour-Driven Development (BDD)

Requirements in Test-Driven Development (TDD) are often represented using User Stories, typically in the following format:

As a [Stakeholder role]
I want [Feature]
So that [Benefit]

In his original blog post1 introducing BDD, North proposed to represent acceptance criteria for each user story as a list of scenarios capturing the expected behaviours of the system, each using the following formulation:

Given [Precondition]
When [Event/Action]
Then [Expected Outcome]

This formulation extends user stories with narratives, each consist of initial condition(s), events or actions that signal the start of the behaviour, and the criteria that characterizes what constitute a successful behaviour. We consider the Given-When-Then formulation a good metamodel because of its simple concepts, which are both easy to understand and flexible to different interpretations and extensions. Furthermore, BDD approaches, e.g. with the popular Gherkin syntax, has wide support in the software engineering community for test automation in many program languages and frameworks. This can reduce the effort in generating executable implementations for verifying BDD acceptance criteria in the future.

Specifying Robotic Scenarios

A challenge of applying BDD to any complex domains is to deal with the myriad variations that may exist for the same scenario. Alferez et al.2 proposed to define scenario templates for common system behaviours, e.g. in their use case for operations on different data structures. Concrete BDD scenarios can then be generated from these templates depending on the particular data object being tested.

Rulebook feature model
Figure 1: A Feature Model of Robotic Competitions

We aim to apply a similar idea for representing robotic scenarios, whose variability dimensions can be vastly more numerous and complex compared to the application investigated by Alferez et al.2. To this end, we analysed rulebooks from several robotic benchmarks and competitions3 to identify common elements used to describe test scenarios at these events. We consolidate our findings is a Feature Model, shown in Figure 1. This serves as the basis for the metamodels described below.

Metamodel Description

We choose to represent our metamodels and models for specifying BDD scenarios with the JSON-LD Schema. The metamodels described below can be found in the following files:

File Description
agent.json Metamodel for specifying agents in a scenario
environment.json Metamodel for specifying elements in the environment of a robotic scenario
task.json Metamodel for specifying task-related concepts and relations in a robotic scenario
event.json Metamodel for specifying event-driven coordination of robot behaviours
bdd.json Metamodel for specifying BDD templates and their variants

For an overview of main JSON-LD keywords used in our models, please take a look at our modelling tutorial. More details on this standard can be found on the official online documentation. For brevity, we use compact IRIs (i.e. use : to separate prefix and suffix) when referring to metamodels concepts and relations below.

Prefix Namespace IRI
agn https://hbrs-sesame.github.io/metamodels/agent#
env https://hbrs-sesame.github.io/metamodels/environment#
task https://hbrs-sesame.github.io/metamodels/task#
evt https://hbrs-sesame.github.io/metamodels/coordination/event#
bdd https://hbrs-sesame.github.io/metamodels/acceptance-criteria/bdd#

Agent

Environment

Task

Coordination

BDD Scenario Templates and Variants

Constraints

Structural

References

  1. D. North, “Behavior Modification: The evolution of behaviour-driven development”, Better Software, 2006. 

  2. M. Alferez, F. Pastore, M. Sabetzadeh, et al., “Bridging the Gap between Requirements Modeling and Behavior-Driven Development,” 22nd MODELS, 2019, doi: 10.1109/MODELS.2019.00008 2

  3. M. Nguyen, N. Hochgeschwender, S. Wrede, “An analysis of behaviour-driven requirement specification for robotic competitions”, 5th International Workshop on Robotics Software Engineering (RoSE’23), May 2023. 

  4. “IEEE Standard Ontologies for Robotics and Automation,” in IEEE Std 1872-2015 , vol., no., pp.1-60, 10 April 2015, doi: 10.1109/IEEESTD.2015.7084073