论文标题
一个集合元估计器,可预测源代码可检验性
An ensemble meta-estimator to predict source code testability
论文作者
论文摘要
与大多数其他软件质量属性不同,不能仅根据源代码的特征来评估可检验性。测试套件的有效性和分配给测试的预算高度影响了正在测试的代码的测试性。测试套件的大小确定了测试工作和成本,而覆盖范围表示测试有效性。因此,可以根据测试套件提供的测试套件的覆盖范围和数量来测量可测试性。本文提供了一个新的方程式,以估算有关给定测试套件的大小和覆盖范围的可检验性。该方程已用于标记属于110个Java项目的23,000个类,其可检验性措施。使用262个指标对标记的类进行矢量。将标记的向量送入了一个有监督的机器学习算法的家族,回归,以根据源代码指标来预测可检验性。回归模型预测了R2为0.68,平均平方误差为0.03,适用于实践中。使用学习模型上的特征重要性分析技术确定了15个软件指标,以高度影响可检验性预测。与相关的研究预测分支覆盖范围作为测试标准相比,提出的模型将平均绝对误差提高了38%。作为可检验性预测的应用,已证明针对改善15个有影响力的软件指标的42个Smelly Java类的自动重构可以平均将其测试性提高86.87%。
Unlike most other software quality attributes, testability cannot be evaluated solely based on the characteristics of the source code. The effectiveness of the test suite and the budget assigned to the test highly impact the testability of the code under test. The size of a test suite determines the test effort and cost, while the coverage measure indicates the test effectiveness. Therefore, testability can be measured based on the coverage and number of test cases provided by a test suite, considering the test budget. This paper offers a new equation to estimate testability regarding the size and coverage of a given test suite. The equation has been used to label 23,000 classes belonging to 110 Java projects with their testability measure. The labeled classes were vectorized using 262 metrics. The labeled vectors were fed into a family of supervised machine learning algorithms, regression, to predict testability in terms of the source code metrics. Regression models predicted testability with an R2 of 0.68 and a mean squared error of 0.03, suitable in practice. Fifteen software metrics highly affecting testability prediction were identified using a feature importance analysis technique on the learned model. The proposed models have improved mean absolute error by 38% due to utilizing new criteria, metrics, and data compared with the relevant study on predicting branch coverage as a test criterion. As an application of testability prediction, it is demonstrated that automated refactoring of 42 smelly Java classes targeted at improving the 15 influential software metrics could elevate their testability by an average of 86.87%.