Answers are grounded in this paper and cite their sources.
Abstract Generally, test cases that closely mirror business logic are easier for practitioners and stakeholders to understand. However, they are typically more expensive to implement compared to cases that execute specific functions without domainspecific specialization. Readability plays a crucial role in enhancing software quality, reducing maintenance costs, and facilitating testing by non-technical personnel. Implementing easily readable test automation solutions may impact code structure and entail additional development and maintenance costs. Yet, the best approach to mitigate these costs remains unaddressed. Existing frameworks often employ ad hoc approaches limited to specialized scenarios, lacking a systematic solution to the cost and readability problem in general. To bridge this gap, we share the challenges and difficulties encountered during the process of creating readable test automation test cases. Drawing from our practical experience, we introduce a new design pattern called the Unit Pattern. This pattern focuses on dividing test logic into the smallest units that convey a clear business meaning, eliminating business domain dependence and ensuring applicability to all projects. The idea behind this approach is straightforward, making implementation very straightforward and with minimal additional costs. Through theoretical analysis and empirical studies using real-world projects from industrial settings, we find that the Unit Pattern has minimal impact on code structure. Our experimental results confirm that applying the Unit Pattern to test automation yields good readability with minimal additional costs.
No takes yet. Share an insight, caveat, or question.
Shan et al. (2024) studied this question.
Synapse has enriched 8 closely related papers on similar clinical questions. Consider them for comparative context: