Domain-Oriented BDD using Pytest: A Design-Focused Approach to Reusable Behaviour Specifications
Main Article Content
Abstract
Automation testing often suffers from brittle scripts that are difficult to maintain and poorly aligned with business requirements. Behavior-Driven Development (BDD) emerged to address this gap by enabling stakeholders to collaborate through a shared, executable specification language. However, without careful structural design, BDD implementations can quickly degrade into unreadable and fragile codebases. This paper proposes an approach that integrates Pytest-BDD with Domain-Oriented Test Design (DOTD) to create reusable, maintainable, and communication-rich behavioural specifications. By combining BDD’s collaborative philosophy, the flexibility of the Pytest ecosystem, and the domain-driven structuring principles of DOTD, the framework ensures that test suites serve not only as verification tools but also as living documentation. This alignment fosters resilience to change, enhances stakeholder communication, and embeds test artefacts within the broader software lifecycle.
Article Details
Section
How to Cite
References
[1] J. F. Smart and J. Molak, BDD in Action: Behavior-driven development for the whole software lifecycle. Simon and Schuster, 2023.
[2] A. H. Mughal, “Advancing BDD Software Testing: Dynamic Scenario Re-Usability And Step Auto-Complete For Cucumber Framework,” arXiv preprint arXiv:2402.15928, 2024.
[3] J. Lång, “In-depth comparison of BDD testing frameworks for Java,” 2022.
[4] A. Molina, Crafting Test-Driven Software with Python: Write test suites that scale with your applications' needs and complexity using Python and PyTest. Packt Publishing Ltd., 2021.
[5] T. Zameni, P. van Den Bos, J. Tretmans, J. Foederer, and A. Rensink, “From BDD scenarios to test case generation,” in Proc. 2023 IEEE Int. Conf. Softw. Testing, Verification and Validation Workshops (ICSTW), Apr. 2023, pp. 36–44.
[6] R. Chanin, A. Santos, and N. Nascimento, “Teaching BDD in Active Learning Environments: A Multi-study Analysis,” in Proc. 14th Int. Conf. Computer Supported Education (CSEDU), Brasil, 2022.
[7] N. P. D. Nascimento, “A study of teaching BDD in active learning environments,” 2020.
[8] M. Irshad, J. Börstler, and K. Petersen, “Supporting refactoring of BDD specifications—An empirical study,” Information and Software Technology, vol. 141, p. 106717, 2022.
[9] V. Mrazek, “Optimization of BDD-based approximation error metrics calculations,” in Proc. 2022 IEEE Computer Society Annu. Symp. VLSI (ISVLSI), Jul. 2022, pp. 86–91.