用机器学习精准选测,提速6倍还留95%故障检出率
Targeted Test Selection Approach in Continuous Integration
- 把代码变更转为文件词袋,结合跨文件特征做预测
- 仅选15%测试用例,执行时间降为原来的1/5.9,提速5.6倍
- 不依赖覆盖率数据,适合工业级CI流水线快速落地
现代软件开发中,基于变更的测试至关重要。但随着代码库扩大和测试套件增长,频繁的每日提交使测试管理日益困难。本文提出目标测试选择(T-TS),一种面向工业场景的机器学习测试选择方法。其核心创新在于将提交表示为变更文件的词袋,并融合跨文件及额外预测特征,显著避免使用覆盖率地图。在生产环境部署后,T-TS在内部与公开数据集上与行业标准及最新方法进行全面对比,评估执行效率与故障检测能力。在真实工业数据上,该方法仅需选择15%的测试用例,执行时间减少5.9倍,流水线加速5.6倍,且能检测超过95%的测试失败。实现已开源,以支持后续研究与实际应用。
原文摘要 · Abstract (English)
In modern software development change-based testing plays a crucial role. However, as codebases expand and test suites grow, efficiently managing the testing process becomes increasingly challenging, especially given the high frequency of daily code commits. We propose Targeted Test Selection (T-TS), a machine learning approach for industrial test selection. Our key innovation is a data representation that represent commits as Bags-of-Words of changed files, incorporates cross-file and additional predictive features, and notably avoids the use of coverage maps. Deployed in production, T-TS was comprehensively evaluated against industry standards and recent methods using both internal and public datasets, measuring time efficiency and fault detection. On live industrial data, T-TS selects only 15% of tests, reduces execution time by $5.9\times$, accelerates the pipeline by $5.6\times$, and detects over 95% of test failures. The implementation is publicly available to support further research and practical adoption.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。