一句话:提出 IncIDFlakies,通过分析代码变更选择性地运行可能产生顺序依赖的测试,低成本检测新引入的顺序依赖型 flaky 测试。
回归测试受 flaky 测试困扰,其中顺序依赖型 flaky 测试的结果取决于测试执行顺序。已有检测方法需在单一代码版本上以不同顺序重跑全部测试,代价高昂,难以适应代码持续演化。本文提出 IncIDFlakies:在 iDFlakies 基础上分析代码变更,仅选择运行受变更影响且可能因共享状态而彼此产生顺序依赖的测试。在 67 个顺序依赖型 flaky 测试上(覆盖其项目中的相关变更,包括使它们变为 flaky 的变更)评估,IncIDFlakies 平均只运行 65.4% 的测试,在运行相同测试顺序数时耗时仅为基线 iDFlakies 全量测试的 68.4%,且仍保证所运行的顺序有可能检测到这些 flaky 测试。
Regression testing is an important part of the software development process but suffers from the presence of flaky tests. Flaky tests are tests that can nondeterministically pass or fail regardless of code changes. Order-dependent flaky tests are a prominent kind of flaky tests whose outcome depends on the test order in which they are run. Prior work has focused on detecting order-dependent flaky tests through rerunning all tests in different test orders on a single version of code. As code is constantly changing, rerunning all tests in different test orders after every change is costly. In this work, we propose IncIDFlakies, a technique to detect order-dependent flaky tests by analyzing code changes to detect newly-introduced order-dependent flaky tests due to those changes. Building upon existing work in iDFlakies that reruns tests in dif- ferent test orders, IncIDFlakies analyzes and selects to run only the tests that (1) are affected by the change, and (2) can potentially result in a test-order dependency among each other due to potential shared state. Running IncIDFlakies on 67 order-dependent flaky tests across changes in code in their respective projects, including the changes where they became flaky, we find that IncIDFlakies can select to run on average 65.4% of all the tests, resulting in running 68.4% of the time that baseline iDFlakies would use when running the same number of test orders with the full test suite. Furthermore, we find that IncIDFlakies can still ensure that the test orders it runs can potentially detect the order-dependent flaky tests.