Testing Highly Configurable Systems (HCSs) is a challenging task, especially in an evolution scenario where features are added, changed, or removed, which hampers test case selection and prioritization. Existing work is usually based on the variability model, which is not always available or updated. Yet, the few existing approaches rely on links between test cases and changed files (or lines of code), not considering how features are implemented, usually spread over several and unchanged files. To overcome these limitations, we introduce FeaTestSelPrio, a feature-oriented test case selection and prioritization approach for HCSs. The approach links test cases to feature implementations, using HCS pre-processor directives, to select test cases based on features affected by changes in each commit. After, the test cases are prioritized according to the number of features they cover. Our approach selects a greater number of tests and takes longer to execute than a changed-file-oriented approach, used as baseline, but FeaTestSelPrio performs better regarding detected failures. By adding the approach execution time to the execution time of the selected test cases, we reached a reduction of $\approx$50%, in comparison with retest-all. The prioritization step allows reducing the average test budget in 86% of the failed commits.
翻译:测试高可配置系统是一项具有挑战性的任务,尤其在系统演化过程中,特征的增删改会阻碍测试用例的选择与优先级排序。现有工作通常基于可变性模型,但该模型并非总能获取或及时更新。此外,现有少数方法依赖于测试用例与变更文件(或代码行)之间的关联,未能考虑特征通常分散在多个未变更文件中实现的方式。为克服这些局限,本文提出FeaTestSelPrio——一种面向特征的高可配置系统测试用例选择与优先级排序方法。该方法利用高可配置系统的预处理器指令,将测试用例与特征实现相关联,从而根据每次提交中受变更影响的特征来选择测试用例。随后,依据测试用例覆盖的特征数量进行优先级排序。与作为基准的面向变更文件的方法相比,本方法选择了更多测试用例且执行耗时更长,但在缺陷检测方面表现更优。通过将方法执行时间与所选测试用例执行时间相加,相较于全量重测,我们实现了约50%的时间缩减。优先级排序步骤使得在86%的失败提交中平均测试预算得以降低。