The University of Texas at Austin
Mitigating and leveraging dependencies between tests
Abstract
dc:description.abstractSoftware testing is essential for ensuring the quality of software systems, but tests do not always behave consistently. While tests are expected to run independent of one another, developers may still accidentally or purposefully introduce dependencies between them. These dependencies can cause tests to pass or fail unpredictably due to test order being uncontrolled, making it difficult for developers to trust test results and identify faults in their code. Understanding and addressing test dependencies is important for improving the reliability and efficiency of software testing. While test dependencies can be problematic for reliability, they also present an opportunity to improve testing efficiency. One way to leverage test dependencies to speed up testing is by removing unnecessary test fixtures. Test fixtures, such as setup and teardown methods, are typically run before and after each test to ensure a clean environment. However, if tests do not need to be isolated from one another using these fixtures while still maintaining consistent outcomes, these fixtures can be executed less frequently or even removed. By grouping dependent tests and minimizing fixture invocations, the overall test execution time can be significantly reduced. First, we propose three new techniques to detect order-dependent flaky tests (OD tests) through a more systematic means of producing test orders. Our techniques build upon prior work in Tuscan squares to cover test pairs in a minimal set of test orders while also obeying the constraints of how tests can be positioned in a test order w.r.t. their test classes. Further, as there are many test pairs that need to be covered, we develop a technique that can take a specified set of test pairs to cover and produce test orders that aim to cover just those test pairs. Our evaluation with 289 known OD tests across 47 test suites from open-source projects shows that our most cost-effective technique can detect 97.2% of the known OD tests with 104.7 test orders, on average, per subject. While all techniques produce a relatively large number of test orders, our analysis of the minimal set of test orders needed to detect OD tests shows a tremendous reduction in the test orders needed to detect OD tests, which represents an opportunity for future work to prioritize test orders. Second, we propose ODRepair, an automated technique to repair OD tests even when no existing test code is available to reset the shared state. The idea is to first determine the exact polluted shared state that results in the OD test to fail and then generate code that can modify and reset the shared state so that the OD 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 OD 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. Third, we propose a new technique to transform test code to speed up test runtime. Our technique, TestBoost, transforms the test fixtures within a test class to instead run once before/after all tests in the test class, thereby running the test fixtures less frequently while still running all tests and ensuring that tests all still pass, as they did before. Our evaluation on 697 test classes from 34 projects shows that on average we can reduce the runtime per test class by 28.39% for the cases with positive significant improvement. Using these transformed test classes can result in an average 18.24% reduction per test suite runtime. We find that the coverage of the transformed test classes changes by less than 1%, and when we submitted 15 pull requests, 9 have already been merged.
Degree
thesis:*- Name thesis:degree_name
- Doctor of Philosophy
- Level thesis:degree_level
- DOCTORAL
- Discipline thesis:degree_discipline
- Electrical and Computer Engineering
- Department thesis:degree_department
- Electrical and Computer Engineering
- Grantor
- The University of Texas at Austin
- Year dc:date.issued
- 2026
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Li, Chengpeng
- Advisor dc:contributor.advisor
-
- Shi, August (August Wang)
- Committee members dc:contributor.committeemember
-
- Legunsen, Owolabi
- Lam, Wing
- Gligoric, Milos
- Khurshid, Sarfraz
Subjects
dc:subject × 3Rights
- Language dc:language.iso
- English
Identifiers
dc:identifier.*- Identifier URI
- https://hdl.handle.net/2152/137058