Domain-specific fixes for flaky tests with wrong assumptions on underdetermined specifications

Peilun Zhang, Yanjie Jiang, Anjiang Wei, Victoria Stodden, Darko Marinov, August Shi

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Library developers can provide classes and methods with underdetermined specifications that allow flexibility in future implementations. Library users may write code that relies on a specific implementation rather than on the specification, e.g., assuming mistakenly that the order of elements cannot change in the future. Prior work proposed the NonDex approach that detects such wrong assumptions. We present a novel approach, called DexFix, to repair wrong assumptions on underdetermined specifications in an automated way. We run the NonDex tool on 200 open-source Java projects and detect 275 tests that fail due to wrong assumptions. The majority of failures are from iterating over HashMap/HashSet collections and the getDeclaredFields method. We provide several new repair strategies that can fix these violations in both the test code and the main code. DexFix proposes fixes for 119 tests from the detected 275 tests. We have already reported fixes for 102 tests as GitHub pull requests: 74 have been merged, with only 5 rejected, and the remaining pending.

Original languageEnglish (US)
Title of host publicationProceedings - 2021 IEEE/ACM 43rd International Conference on Software Engineering, ICSE 2021
PublisherIEEE Computer Society
Pages50-61
Number of pages12
ISBN (Electronic)9780738113197
DOIs
StatePublished - May 2021
Event43rd IEEE/ACM International Conference on Software Engineering, ICSE 2021 - Virtual, Online, Spain
Duration: May 22 2021May 30 2021

Publication series

NameProceedings - International Conference on Software Engineering
ISSN (Print)0270-5257

Conference

Conference43rd IEEE/ACM International Conference on Software Engineering, ICSE 2021
Country/TerritorySpain
CityVirtual, Online
Period5/22/215/30/21

ASJC Scopus subject areas

  • Software

Fingerprint

Dive into the research topics of 'Domain-specific fixes for flaky tests with wrong assumptions on underdetermined specifications'. Together they form a unique fingerprint.

Cite this