Relationship between flaky tests and requirements
Date
Authors
Journal Title
Journal ISSN
Volume Title
Publisher
Abstract
Flaky tests produce inconsistent results without code changes, representing a significant challenge in software development by undermining developer confidence and delaying continuous integration processes [33]. Despite their recognized impact on software quality assurance, the relationship between requirements quality and test instability remains underexplored in industrial contexts. This study investigates how industry practitioners perceive the relationship between requirements quality and flaky tests and identifies specific requirements quality attributes that most significantly contribute to this problem, providing evidence-based guidelines to mitigate these issues. A mixed-methods approach was employed by combining quantitative survey data from 74 industrial practitioners with qualitative semi-structured interviews from eight professionals across diverse domains, including automotive, banking, healthcare, and software development. The findings establish flaky tests as a widespread phenomenon, with 80% of practitioners reporting regular encounters with test flakiness in their projects. The study reveals a notable awareness practice gap: while 80% of practitioners recognize that requirement completeness frequently impacts test stability, only 56% consistently consult requirements during flaky test investigations. This selective behavior reflects sophisticated contextual reasoning rather than a lack of knowledge, with practitioners strategically assessing when requirements-related factors are likely contributors versus when technical diagnostics are more appropriate. The critical requirements quality attributes emerge as contributors to test flakiness: completeness deficiencies (including unspecified timeout durations affecting 77% of practitioners, missing acceptance criteria at 61%, and incomplete data specifications at 62%), and ambiguity issues (especially unclear success and failure conditions reported by 65%). The research identifies timing specifications as a critical blind spot in current requirements practices, often treated as implementation details rather than explicit requirements, leading to cascading effects where independent timing assumptions by developers and testers create environment sensitive test behavior. The study demonstrates significant domain-specific variation in the requirements-flakiness relationship, with practitioners reporting varying levels of requirements related contributions across different sectors. Structured domains with formal processes (banking, healthcare) show lower requirements related flakiness, while less regulated environments experience higher impacts. This contextual dependency reflects how organizational processes, regulatory constraints, and system criticality mediate the impact of requirements quality on test stability. Based on empirical findings, the research presents evidence-based guidelines organized around fundamental requirements quality attributes to systematically reduce requirements related test flakiness. These guidelines provide systematic approaches for organizations to reduce requirements-related test flakiness through targeted interventions addressing the identified quality gaps. The study establishes requirements quality as a measurable contributor to software system reliability, with practitioners estimating that 21-60% of flaky tests originate from requirements related issues, deserving systematic attention alongside traditional technical factors in software quality assurance efforts.