Flaky Test Sanitisation via On-the-Fly Assumption Inference for Tests with Network Dependencies

Jens Dietrich, Shawn Rasheed, Amjed Tahir
8/1/2022
cs.SE

Official code: jensdietrich/saflate (2 stars, Java, Apache-2.0, last commit 2022-03-25).

Abstract

Flaky tests cause significant problems as they can interrupt automated build processes that rely on all tests succeeding and undermine the trustworthiness of tests. Numerous causes of test flakiness have been identified, and program analyses exist to detect such tests.

Show full abstract

Typically, these methods produce advice to developers on how to refactor tests in order to make test outcomes deterministic. We argue that one source of flakiness is the lack of assumptions that precisely describe under which circumstances a test is meaningful. We devise a sanitisation technique that can isolate f laky tests quickly by inferring such assumptions on-the-fly, allowing automated builds to proceed as flaky tests are ignored. We demonstrate this approach for Java and Groovy programs by implementing it as extensions for three popular testing frameworks (JUnit4, JUnit5 and Spock) that can transparently inject the inferred assumptions. If JUnit5 is used, those extensions can be deployed without refactoring project source code. We demonstrate and evaluate the utility of our approach using a set of six popular real-world programs, addressing known test flakiness issues in these programs caused by dependencies of tests on network availability. We find that our method effectively sanitises failures induced by network connectivity problems with high precision and recall.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

junit extensions / rules to reduce test flakiness

21JavaDec 16, 20214 years agoApache-2.0

Similar Papers

Cite this paper

@article{dietrich2022flaky,
  title  = {Flaky Test Sanitisation via On-the-Fly Assumption Inference for Tests with Network Dependencies},
  author = {Jens Dietrich and Shawn Rasheed and Amjed Tahir},
  year   = {2022},
  eprint = {2208.01106},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.01106}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.01106.svg)](https://codeofpaper.com/paper/2208.01106)

Discussion