AI 中文总结
本文针对 JavaScript 结构可测试性展开大规模实证研究,定义七维结构并汇总为 CTS,应用于 30 个开源项目,分析其分布等,发现结构有挑战的函数集中在少量文件且通过多种重复配置出现,为相关研究奠定基础。
AI 中文摘要
软件可测试性长期以来被视为影响测试工作量和有效性的软件质量属性。此前对面向对象和并发软件的可测试性研究广泛,但对现代 JavaScript 系统的结构可测试性了解较少。JavaScript 应用依赖异步执行等特性,现有框架未明确涵盖。本文对 JavaScript 的结构可测试性进行大规模实证研究。将其定义为包含可控性等七个维度的结构,通过基于 AST 的静态分析得出并汇总为综合可测试性分数(CTS)。应用该框架于 30 个开源 JavaScript 项目,分析结构可测试性分布等。发现具有结构挑战的函数集中在少量文件中,通过多种重复结构配置出现。这些发现为 JavaScript 结构可测试性提供新见解,为未来相关研究奠定基础。
英文摘要
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.