一句话:提出基于机器学习的持续测试套件失败预测,判断代码变更是否值得触发测试,从而降低持续集成成本。
持续集成要求对每次代码变更频繁运行完整测试套件,带来高昂计算成本甚至人工等待成本,而实际只有约 4% 的测试套件调用会使原本通过的测试转为失败。本文提出持续测试套件失败预测,通过预测某次代码变更是否应触发测试套件来降低持续集成开销。方法核心是机器学习模型,其输入特征来自代码变更、测试套件以及项目开发历史,同时给出一个理论成本模型,刻画该方法在何种条件下值得使用。作者在 242 个开源项目的 1.5 万次测试套件运行上进行评估,结果表明该方法能有效预测运行测试是否可能暴露失败,并且相比即时缺陷预测和测试用例失败预测的基线特征,AUC 分别提升 13.9% 和 2.9%。
Continuous integration advocates to run the test suite of a project frequently, e.g., for every code change committed to a shared repository. This process imposes a high computational cost and sometimes also a high human cost, e.g., when developers must wait for the test suite to pass before a change appears in the main branch of the shared repository. However, only 4% of all test suite invocations turn a previously passing test suite into a failing test suite. The question arises whether running the test suite for each code change is really necessary. This paper presents continuous test suite failure prediction, which reduces the cost of continuous integration by predicting whether a particular code change should trigger the test suite at all. The core of the approach is a machine learning model based on features of the code change, the test suite, and the development history. We also present a theoretical cost model that describes when continuous test suite failure prediction is worthwhile. Evaluating the idea with 15k test suite runs from 242 open-source projects shows that the approach is effective at predicting whether running the test suite is likely to reveal a test failure. Moreover, we find that our approach improves the AUC over baselines that use features proposed for just-in-time defect prediction and test case failure prediction by 13.9% and 2.9%, respectively. Overall, continuous test suite failure prediction can significantly reduce the cost of continuous integration.
DOI 原文 ·
@inproceedings{paperbot6654,
title = {Continuous test suite failure prediction},
author = {Cong Pan and Michael Pradel},
booktitle = {ISSTA},
year = {2021},
doi = {10.1145/3460319.3464840}
}