Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined Specifications

Domain-Specific Fixes for Flaky Tests with Wrong Assumptions on Underdetermined Specifications
复制标题

DOI:
10.1109/icse43902.2021.00018
复制
发表时间:
2021-05
期刊:
2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE)
影响因子:
--
通讯作者:
Peilun Zhang;Yanjie Jiang;Anjiang Wei;V. Stodden;D. Marinov;A. Shi
Peilun Zhang;Yanjie Jiang;Anjiang Wei;V. Stodden;D. Marinov;A. Shi
中科院分区:
其他
文献类型:
--
作者:
Peilun Zhang;Yanjie Jiang;Anjiang Wei;V. Stodden;D. Marinov;A. Shi

文献摘要

被引文献

相似文献

库开发人员可以提供具有欠确定规范的类和方法,以便在将来的实现中具有灵活性。库用户可以编写依赖于特定实现而不是规范的代码,例如,错误地假设元素的顺序在将来不会改变。先前的工作提出了NonDex方法来检测这种错误的假设。我们提出了一种新的方法,称为DexFix,以自动化的方式来修复欠定规格的错误假设。我们在200个开源Java项目上运行了NonDex工具,并检测到275个由于错误假设而失败的测试。大多数失败都来自于迭代HashMap/HashSet集合和getDeclaredFields方法。我们提供了几种新的修复策略,可以在测试代码和主代码中修复这些违规。DexFix建议修复检测到的275个测试中的119个测试。我们已经报告了102个测试的修复作为GitHub pull requests:74个已经合并,只有5个被拒绝,其余的待定。
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.