Characterizing Structural Testability in JavaScript: An Empirical Study
Abstract
Software testability has long been recognized as a software quality attribute that influences testing effort and effectiveness. While prior work has extensively studied testability in object-oriented and concurrent software, comparatively little is known about structural testability in modern JavaScript systems. JavaScript applications rely on asynchronous execution, event-driven control flow, closures, and dynamic interactions that are not explicitly captured by existing testability frameworks. This paper presents a large-scale empirical study of structural testability in JavaScript. We operationalize structural testability as a seven-dimensional construct capturing controllability, observability, branching complexity, asynchronous coordination, event-driven behaviour, encapsulation, and side-effect intensity. These dimensions are derived from AST-based static analysis and aggregated into a Composite Testability Score (CTS) for comparative analysis across functions, files, and projects. We apply this framework to 30 open-source JavaScript projects spanning diverse domains and sizes. Our analysis characterizes the distribution of structural testability, identifies recurring structural archetypes among low-CTS functions, and examines associations between project characteristics and testability. We find that structurally-challenging functions are concentrated within a relatively small subset of files and arise through multiple recurring structural configurations rather than a single dominant pattern. These findings provide new insight into structural testability in JavaScript and establish a foundation for future research on testing effort, automated test generation, testability-aware refactoring, and software quality assessment.
Create a lesson
Related papers
How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches
Shared title terminologycs.SEAakash Goel, Benjamin Steenhoek, Yu Hu
Diffs Are Cheap, Show Me the Trajectory: An Empirical Study of Trajectory-Informed Code Review
Shared title terminologycs.SEZijian Luo, Pengfei Gao, Dayi Lin et al.
Can Vibe Coding Produce Accessible Websites: An Empirical Study on LLM Coding Agents and Skills
Shared title terminologycs.SESyed Fatiul Huq, Md. Asif Haider, Abu Jafar Saifullah et al.
Characterizing and Detecting Unfaithful Work Reports by Coding Agents
Shared title terminologycs.SEWenhao Yang, Runzhi He, Minghui Zhou et al.
Characterizing GitHub Security Actions Alerts For Web Application Tutorials
Shared title terminologycs.SEBhagya Chembakottu, Martin P. Robillard
Trace2ST: Recovering PLC Structured Text from I/O Traces with LLM Generation and Verification
Shared title terminologycs.SEHsi Chang, Irfan Khan