StubCoder : Automated Generation and Repair of Stub Code for Mock Objects

Author:

Zhu Hengcheng1ORCID,Wei Lili2ORCID,Terragni Valerio3ORCID,Liu Yepang4ORCID,Cheung Shing-Chi1ORCID,Wu Jiarong1ORCID,Sheng Qin5ORCID,Zhang Bing5ORCID,Song Lihong5ORCID

Affiliation:

1. The Hong Kong University of Science and Technology, China

2. McGill University, Canada

3. The University of Auckland, New Zealand

4. Southern University of Science and Technology, China

5. WeBank Co. Ltd., China

Abstract

Mocking is an essential unit testing technique for isolating the class under test 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 article, 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.

Funder

National Science Foundation of China

Hong Kong Research Grant Council/General Research Fund

Hong Kong Research Grant Council/Research Impact Fund

Natural Sciences and Engineering Research Council of Canada Discovery Grant

WeBank-HKUST Joint Laboratory

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference59 articles.

1. Dagstuhl Seminar Proceedings Practical Software Testing: Tool Automation and Human Factors. 10111 Nadia Alshahwan Yue Jia Kiran Lakhotia Gordon Fraser David Shuler Paolo Tonella AUTOMOCK: Automated synthesis of a mock environment for test case generation 2010

2. Introduction to Software Testing

3. Automated unit test generation for classes with environment dependencies

4. Generating TCP/UDP network data for automated unit test generation

5. Private API Access and Functional Mocking in Automated Unit Test Generation

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3