MR-Adopt: Automatic Deduction of Input Transformation Function for Metamorphic Testing
While a recent study reveals that many developer-written test cases can encode a reusable Metamorphic Relation (MR), over 70% of them directly hard-code the source input and follow-up input in the encoded relation. Such encoded MRs, which do not contain an explicit input transformation to transform the source inputs to corresponding follow-up inputs, cannot be reused with new source inputs to enhance test adequacy.
In this paper, we propose MR-Adopt (Automatic Deduction Of inPut Transformation) to automatically deduce the input transformation from the hard-coded source and follow-up inputs, aiming to enable the encoded MRs to be reused with new source inputs. With typically only one pair of source and follow-up inputs available in an MR-encoded test case as the example, we leveraged LLMs to understand the intention of the test case and generate additional examples of source-followup input pairs. This helps to guide the generation of input transformations generalizable to multiple source inputs. Besides, to mitigate the issue that LLMs generate erroneous code, we refine LLM-generated transformations by removing MR-irrelevant code elements with data-flow analysis. Finally, we assess candidate transformations based on encoded output relations and select the best transformation as the result. Evaluation results show that MR-Adopt can generate input transformations applicable to all experimental source inputs for 72.00% of encoded MRs, which is 33.33% more than using vanilla GPT-3.5. By incorporating MRAdopt-generated input transformations, encoded MR-based test cases can effectively enhance the test adequacy, increasing the line coverage and mutation score by 10.62% and 18.91%, respectively.
Tue 29 OctDisplayed time zone: Pacific Time (US & Canada) change
13:30 - 15:00 | Testing 1Research Papers / Industry Showcase at Gardenia Chair(s): Jialun Cao Hong Kong University of Science and Technology | ||
13:30 15mTalk | Spotting Code Mutation for Predictive Mutation Testing Research Papers Yifan Zhao Peking University, Yizhou Chen Peking University, Zeyu Sun Institute of Software, Chinese Academy of Sciences, Qingyuan Liang Peking University, Guoqing Wang Peking University, Dan Hao Peking University | ||
13:45 15mTalk | Efficient Detection of Test Interference in C Projects Research Papers | ||
14:00 15mTalk | MR-Adopt: Automatic Deduction of Input Transformation Function for Metamorphic Testing Research Papers Congying Xu The Hong Kong University of Science and Technology, China, Songqiang Chen The Hong Kong University of Science and Technology, Jiarong Wu The Hong Kong University of Science and Technology, Shing-Chi Cheung Hong Kong University of Science and Technology, Valerio Terragni University of Auckland, Hengcheng Zhu The Hong Kong University of Science and Technology, Jialun Cao Hong Kong University of Science and Technology | ||
14:15 15mTalk | Approximation-guided Fairness Testing through Discriminatory Space Analysis Research Papers Zhenjiang Zhao Graduate School of Informatics and Engineering, University of Electro-Communications, Tokyo, Japan, Takahisa Toda The University of Electro-Communications, Takashi Kitamura | ||
14:30 15mTalk | Integrating Mutation Testing into Developer Workflow: An Industrial Case Study Industry Showcase Stefan Alexander van Heijningen Chalmers and University of Gothenburg, Theo Wiik Chalmers and University of Gothenburg, Francisco Gomes de Oliveira Neto Chalmers | University of Gothenburg, Gregory Gay Chalmers | University of Gothenburg, Kim Viggedal Zenseact, David Friberg Zenseact | ||
14:45 15mTalk | Test Case Generation for Simulink Models using Model Fuzzing and State Solving Research Papers Zhuo Su KLISS, BNRist, School of Software, Tsinghua University, Zehong Yu KLISS, BNRist, School of Software, Tsinghua University, Dongyan Wang Information Technology Center, Renmin University of China, Wanli Chang College of Computer Science and Electronic Engineering, Hunan University, Bin Gu Beijing Institute of Control Engineering, Yu Jiang Tsinghua University |