Extracting Inline Tests from Unit Tests
Yu Liu, Pengyu Nie, Anna Guo, Milos Gligoric, Owolabi Legunsen
摘要
We recently proposed inline tests for validating individual program statements; they allow developers to provide test inputs, expected outputs, and test oracles immediately after a target statement. But, existing code can have many target statements. So, automatic generation of inline tests is an important next step towards increasing their adoption. We propose ExLi, the first technique for automatically generating inline tests. ExLi extracts inline tests from unit tests; it first records all variable values at a target statement while executing unit tests. Then, ExLi uses those values as test inputs and test oracles in an initial set of generated inline tests. Target statements that are executed many times could have redundant initial inline tests. So, ExLi uses a novel coverage-then-mutants based reduction process to remove redundant inline tests. We implement ExLi for Java and use it to generate inline tests for 718 target statements in 31 open-source programs. ExLi reduces 17,273 initially generated inline tests to 905 inline tests. The final set of generated inline tests kills up to 25.1% more mutants on target statements than developer written and automatically generated unit tests. That is, ExLi generates inline tests that can improve the fault-detection capability of the test suites from which they are extracted.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- TOGA: A Neural Method for Test Oracle Generation 引用了 On learning meaningful assert statements for unit test cases
- exLong: Generating Exceptional Behavior Tests with Large Language Models 引用了 TOGA: A Neural Method for Test Oracle Generation
- exLong: Generating Exceptional Behavior Tests with Large Language Models 引用了 On learning meaningful assert statements for unit test cases
- exLong: Generating Exceptional Behavior Tests with Large Language Models 引用了 Learning Deep Semantics for Test Completion
- Automated Assertion Generation via Information Retrieval and Its Integration with Deep learning 引用了 On learning meaningful assert statements for unit test cases
- Learning Deep Semantics for Test Completion 引用了 TOGA: A Neural Method for Test Oracle Generation
- Learning Deep Semantics for Test Completion 引用了 On learning meaningful assert statements for unit test cases
引用它的顶会 Paper2
它引用的 Paper7
- On learning meaningful assert statements for unit test casesCody Watson, Michele Tufano, Kevin Moran, Gabriele Bavota 等ICSE 2020 · 96 次引用
- TOGA: A Neural Method for Test Oracle GenerationElizabeth Dinella, Gabriel Ryan, Todd Mytkowicz, Shuvendu K. LahiriICSE 2022 · 92 次引用
- Revisiting the Relationship Between Fault Detection, Test Adequacy Criteria, and Test Set SizeYiqun T. Chen, Rahul Gopinath, Anita Tadakamalla, Michael D. Ernst 等ASE 2020 · 48 次引用
- Learning Deep Semantics for Test CompletionPengyu Nie, Rahul Banerjee, Junyi Jessy Li, Raymond J. Mooney 等ICSE 2023 · 45 次引用
- Automated Assertion Generation via Information Retrieval and Its Integration with Deep learningHao Yu, Yiling Lou, Ke Sun, Dezhi Ran 等ICSE 2022 · 42 次引用
相关 Paper
- Block TestsKevin Guan, Pengyue Jiang, Milos Gligoric, Owolabi LegunsenOOPSLA 2026
- Inline TestsYu Liu, Pengyu Nie, Owolabi Legunsen, Milos GligoricASE 2022 · 10 次引用
- State Field Coverage: A Metric for Oracle QualityFacundo Molina, Nazareno Aguirre, Alessandra GorlaASE 2025 · 1 次引用
- MR-Adopt: Automatic Deduction of Input Transformation Function for Metamorphic TestingCongying Xu, Songqiang Chen, Jiarong Wu, Shing-Chi Cheung 等ASE 2024 · 6 次引用
- Perfect is the enemy of test oracleAli Reza Ibrahimzada, Yigit Varli, Dilara Tekinoglu, Reyhaneh JabbarvandFSE 2022 · 23 次引用
