Abstract

Behavior-driven development (BDD) is a variant of test-driven development where specifications are described in a structured domain-specific natural language. Although refactoring is a crucial activity of BDD, little research is available on the topic. To support practitioners in refactoring BDD specifications by (1) proposing semi-automated approaches to identify refactoring candidates; (2) defining refactoring techniques for BDD specifications; and (3) evaluating the proposed identification approaches in an industry context. Using Action Research, we have developed an approach for identifying refactoring candidates in BDD specifications based on two measures of similarity and applied the approach in two projects of a large software organization. The accuracy of the measures for identifying refactoring candidates was then evaluated against an approach based on machine learning and a manual approach based on practitioner perception. We proposed two measures of similarity to support the identification of refactoring candidates in a BDD specification base; (1) normalized compression similarity (NCS) and (2) similarity ratio (SR). A semi-automated approach based on NCS and SR was developed and applied to two industrial cases to identify refactoring candidates. Our results show that our approach can identify candidates for refactoring 6o times faster than a manual approach. Our results furthermore showed that our measures accurately identified refactoring candidates compared with a manual identification by software practitioners and outperformed an ML-based text classification approach. We also described four types of refactoring techniques applicable to BDD specifications; merging candidates, restructuring candidates, deleting duplicates, and renaming specification titles. Our results show that NCS and SR can help practitioners in accurately identifying BDD specifications that are suitable candidates for refactoring, which also decreases the time for identifying refactoring candidates.

Highlights

  • Behavior-driven development (BDD) was initially proposed to facilitate the understanding of software requirements and link those requirements to test cases [1,2]

  • Since all studies above reported a positive experience of using Normalized Compression Distance (NCD) for text-based artifacts, we investigated the usage of NCD for determining similar BDD specifications

  • Assessing the impact on the quality and consistency of the refactored software are specific to the software product that is refactored and are not applicable to BDD specifications

Read more

Summary

Introduction

Behavior-driven development (BDD) was initially proposed to facilitate the understanding of software requirements and link those requirements to test cases [1,2]. Nowadays, it is emerging as a separate software development process [3]. BDD overcomes the information loss between user stories and test cases by writing requirements in a structured natural language format that can be instrumented and used in automated testing. A BDD scenario consists of (i) a specification (requirements) written using structured natural language and (ii) hooks to the test code for validating the specification [4]. North proposed to describe requirements in the form of scenarios comprising three parts or steps [1]: (1) Pre-conditions are stated in Given, (2) When describes the role(s)/requirement(s) of the actor acting in the scenario, and (3) describes the action and/or outcome that

Objectives
Results
Discussion
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call