StubCoder: Automated Generation and Repair of Stub Code for Mock Objects
Hengcheng Zhu, Lili Wei, Valerio Terragni, Yepang Liu, Shing-Chi, Cheung, Jiarong Wu, Qin Sheng, Bing Zhang, Lihong Song

TL;DR
StubCoder is an automated tool that uses an evolutionary algorithm to generate and repair stub code for mock objects, improving regression testing efficiency and accuracy.
Contribution
The paper introduces StubCoder, a novel evolutionary algorithm-based approach for automatic generation and repair of stub code in mocking frameworks.
Findings
Successfully generated stub code for incomplete test cases.
Effectively repaired broken stub code in obsolete test cases.
Demonstrated effectiveness on 59 test cases from 13 open-source projects.
Abstract
Mocking is an essential unit testing technique for isolating the class under test (CUT) from its dependencies. Developers often leverage mocking frameworks to develop stub code that specifies the behaviors of mock objects. However, developing and maintaining stub code is labor-intensive and error-prone. In this paper, we present StubCoder to automatically generate and repair stub code for regression testing. StubCoder implements a novel evolutionary algorithm that synthesizes test-passing stub code guided by the runtime behavior of test cases. We evaluated our proposed approach on 59 test cases from 13 open-source projects. Our evaluation results show that StubCoder can effectively generate stub code for incomplete test cases without stub code and repair obsolete test cases with broken stub code.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Software Reliability and Analysis Research · Software Engineering Research
