Flaky tests can make automated software testing unreliable due to their unpredictable behavior. These tests can pass or fail on the same code base on multiple runs. However, flaky tests often do not refer to any fault, even though they can cause the continuous integration (CI) pipeline to fail. A common type of flaky test is the order-dependent (OD) test. The outcome of an OD test depends on the order in which it is run with respect to other test cases. Several studies have explored the detection and repair of OD tests. However, their methods require re-runs of tests multiple times, that are not related to the order dependence. Hence, prioritizing potential OD tests is necessary to reduce the re-runs. In this paper, we propose a method to prioritize potential order-dependent tests. By analyzing shared static fields in test classes, we identify tests that are more likely to be order-dependent. In our experiment on 27 project modules, our method successfully prioritized all OD tests in 23 cases, reducing test executions by an average of 65.92% and unnecessary re-runs by 72.19%. These results demonstrate that our approach significantly improves the efficiency of OD test detection by lowering execution costs.
翻译:不稳定测试因其不可预测的行为可能导致自动化软件测试不可靠。这些测试在相同代码库上多次运行时可能通过或失败。然而,不稳定测试通常并不指示实际缺陷,却可能造成持续集成(CI)流水线失败。顺序依赖型(OD)测试是常见的不稳定测试类型,其执行结果取决于与其他测试用例的运行顺序。已有若干研究探索了OD测试的检测与修复方法,但这些方法需要对测试进行多次与顺序依赖性无关的重运行。因此,为减少重运行次数,对潜在OD测试进行优先排序至关重要。本文提出一种优先排序潜在顺序依赖型测试的方法。通过分析测试类中的共享静态字段,我们识别出更可能具有顺序依赖性的测试。在针对27个项目模块的实验中,本方法在23个案例中成功优先排序了所有OD测试,平均减少测试执行次数65.92%,降低不必要重运行72.19%。这些结果表明,该方法通过降低执行成本,显著提升了OD测试检测的效率。