论文标题
学习预测测试有效性
Learning to predict test effectiveness
论文作者
论文摘要
只要可以预见,测试的固有功能是可以预见的,可以大大降低测试的高成本。本文提供了一种机器学习模型,以预测测试可以在多大程度上覆盖类,该班级称为Coveragabiblesion。预测模型由四个回归模型的集合组成。学习样本由特征向量组成,其中特征是为类计算的源代码指标。样品由针对其相应类计算的覆盖率值标记。我们提供了一个数学模型,以评估每个班级自动生成的测试套件的尺寸和覆盖范围的测试效果。我们通过引入一种新方法来根据现有源代码指标来定义子计量数来扩展功能空间的大小。使用功能重要性分析在学习的预测模型上,我们按照其对测试效果的影响顺序对源代码进行排序。结果,我们发现类别的循环复杂性是最有影响力的源代码指标。我们对包含大约23,000个类的大型Java项目的预测模型进行的实验表明,平均绝对误差(MAE)为0.032,平均平方误差(MSE)为0.004,R2得分为0.855。与最先进的覆盖范围预测模型相比,我们的模型分别提高了MAE,MSE和R2得分的5.78%,2.84%和20.71%。
The high cost of the test can be dramatically reduced, provided that the coverability as an inherent feature of the code under test is predictable. This article offers a machine learning model to predict the extent to which the test could cover a class in terms of a new metric called Coverageability. The prediction model consists of an ensemble of four regression models. The learning samples consist of feature vectors, where features are source code metrics computed for a class. The samples are labeled by the Coverageability values computed for their corresponding classes. We offer a mathematical model to evaluate test effectiveness in terms of size and coverage of the test suite generated automatically for each class. We extend the size of the feature space by introducing a new approach to defining sub-metrics in terms of existing source code metrics. Using feature importance analysis on the learned prediction models, we sort source code metrics in the order of their impact on the test effectiveness. As a result of which, we found the class strict cyclomatic complexity as the most influential source code metric. Our experiments with the prediction models on a large corpus of Java projects containing about 23,000 classes demonstrate the Mean Absolute Error (MAE) of 0.032, Mean Squared Error (MSE) of 0.004, and an R2-score of 0.855. Compared with the state-of-the-art coverage prediction models, our models improve MAE, MSE, and an R2-score by 5.78%, 2.84%, and 20.71%, respectively.