Repairing Order-Dependent Flaky Tests via Test Generation
摘要
Flaky tests are tests that pass or fail nondeterministically on the same version of code. These tests can mislead developers concerning the quality of their code changes during regression testing. A common kind of flaky tests are order-dependent tests, whose pass/ fail outcomes depend on the test order in which they are run. Such tests have different outcomes because other tests running before them pollute shared state. Prior work has proposed repairing orderdependent tests by searching for existing tests, known as "cleaners", that reset the shared state, allowing the order-dependent test to pass when run after a polluted shared state. The code within a cleaner represents a patch to repair the order-dependent test. However, this technique requires cleaners to already exist in the test suite. We propose ODRepair, an automated technique to repair orderdependent tests even without existing cleaners. The idea is to first determine the exact polluted shared state that results in the orderdependent test to fail and then generate code that can modify and reset the shared state so that the order-dependent test can pass. We focus on shared state through internal heap memory, in particular shared state reachable from static fields. Once we know which static field leads to the pollution, we search for reset-methods in the codebase that can potentially access and modify state reachable from that static field. We then apply an automatic test-generation tool to generate method-call sequences, targeting these reset-methods. Our evaluation on 327 order-dependent tests from a publicly available dataset shows that ODRepair automatically identifies the polluted static field for 181 tests, and it can generate patches for 141 of these tests. Compared against state-of-the-art iFixFlakies, ODRepair can generate patches for 24 tests that iFixFlakies cannot.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Reducing Test Runtime by Transforming Test Fixtures 引用了 Evolution-aware detection of order-dependent flaky tests
- Reducing Test Runtime by Transforming Test Fixtures 引用了 A large-scale longitudinal study of flaky tests
- Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined Specifications 引用了 A large-scale longitudinal study of flaky tests
- FLEX: fixing flaky tests in machine learning projects by updating assertion bounds 引用了 Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined Specifications
- FLEX: fixing flaky tests in machine learning projects by updating assertion bounds 引用了 Detecting flaky tests in probabilistic and machine learning applications
- Evolution-aware detection of order-dependent flaky tests 引用了 A large-scale longitudinal study of flaky tests
- Evolution-aware detection of order-dependent flaky tests 引用了 Detecting flaky tests in probabilistic and machine learning applications
- Evolution-aware detection of order-dependent flaky tests 引用了 Dependent-test-aware regression testing techniques
- Ranking Relevant Tests for Order-Dependent Flaky Tests 引用了 Evolution-aware detection of order-dependent flaky tests
- Ranking Relevant Tests for Order-Dependent Flaky Tests 引用了 A large-scale longitudinal study of flaky tests
- Ranking Relevant Tests for Order-Dependent Flaky Tests 引用了 Dependent-test-aware regression testing techniques
- Preempting Flaky Tests via Non-Idempotent-Outcome Tests 引用了 Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined Specifications
- Preempting Flaky Tests via Non-Idempotent-Outcome Tests 引用了 FLEX: fixing flaky tests in machine learning projects by updating assertion bounds
- Preempting Flaky Tests via Non-Idempotent-Outcome Tests 引用了 A large-scale longitudinal study of flaky tests
- Preempting Flaky Tests via Non-Idempotent-Outcome Tests 引用了 Detecting flaky tests in probabilistic and machine learning applications
- Preempting Flaky Tests via Non-Idempotent-Outcome Tests 引用了 Dependent-test-aware regression testing techniques
- Do Automatic Test Generation Tools Generate Flaky Tests? 引用了 Preempting Flaky Tests via Non-Idempotent-Outcome Tests
- Do Automatic Test Generation Tools Generate Flaky Tests? 引用了 Detecting flaky tests in probabilistic and machine learning applications
- Do Automatic Test Generation Tools Generate Flaky Tests? 引用了 Dependent-test-aware regression testing techniques
引用它的顶会 Paper7
- Preempting Flaky Tests via Non-Idempotent-Outcome TestsAnjiang Wei, Pu Yi, Zhengxi Li, Tao Xie 等ICSE 2022 · 20 次引用
- Evolution-aware detection of order-dependent flaky testsChengpeng Li, August ShiISSTA 2022 · 12 次引用
- Do Automatic Test Generation Tools Generate Flaky Tests?Martin Gruber, Muhammad Firhard Roslan, Owain Parry, Fabian Scharnböck 等ICSE 2024 · 12 次引用
- Reducing Test Runtime by Transforming Test FixturesChengpeng Li, Abdelrahman Baz, August ShiASE 2024 · 1 次引用
- Ranking Relevant Tests for Order-Dependent Flaky TestsShanto Rahman, Bala Naren Chanumolu, Suzzana Rafi, August Shi 等ICSE 2025 · 1 次引用
它引用的 Paper6
- Detecting flaky tests in probabilistic and machine learning applicationsSaikat Dutta, August Shi, Rutvik Choudhary, Zhekun Zhang 等ISSTA 2020 · 71 次引用
- A large-scale longitudinal study of flaky testsWing Lam, Stefan Winter, Anjiang Wei, Tao Xie 等OOPSLA 2020 · 63 次引用
- Dependent-test-aware regression testing techniquesWing Lam, August Shi, Reed Oei, Sai Zhang 等ISSTA 2020 · 44 次引用
- FLEX: fixing flaky tests in machine learning projects by updating assertion boundsSaikat Dutta, August Shi, Sasa MisailovicFSE 2021 · 33 次引用
- Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined SpecificationsPeilun Zhang, Yanjie Jiang, Anjiang Wei, Victoria Stodden 等ICSE 2021 · 26 次引用
相关 Paper
- A Dataset of Reproducible Flaky-Test FailuresSuzzana Rafi, Mahbub-Ul-Hoque Sumon, Md Erfan, Maruf Morshed Khan 等ISSTA 2026
- Systematically Producing Test Orders to Detect Order-Dependent Flaky TestsChengpeng Li, Mohammad Mahdi Khosravi, Wing Lam, August ShiISSTA 2023 · 10 次引用
- FlakeSync: Automatically Repairing Async Flaky TestsShanto Rahman, August ShiICSE 2024 · 7 次引用
- Neurosymbolic Repair of Test FlakinessYang Chen, Reyhaneh JabbarvandISSTA 2024 · 8 次引用
- FlakiMe: Laboratory-Controlled Test Flakiness Impact AssessmentMaxime Cordy, Renaud Rwemalika, Adriano Franci, Mike Papadakis 等ICSE 2022 · 14 次引用
