Towards Generating Executable Metamorphic Relations Using Large Language Models (2401.17019v3)
Abstract: Metamorphic testing (MT) has proven to be a successful solution to automating testing and addressing the oracle problem. However, it entails manually deriving metamorphic relations (MRs) and converting them into an executable form; these steps are time-consuming and may prevent the adoption of MT. In this paper, we propose an approach for automatically deriving executable MRs (EMRs) from requirements using LLMs. Instead of merely asking the LLM to produce EMRs, our approach relies on a few-shot prompting strategy to instruct the LLM to perform activities in the MT process, by providing requirements and API specifications, as one would do with software engineers. To assess the feasibility of our approach, we conducted a questionnaire-based survey in collaboration with Siemens Industry Software, a worldwide leader in providing industry software and services, focusing on four of their software applications. Additionally, we evaluated the accuracy of the generated EMRs for a Web application. The outcomes of our study are highly promising, as they demonstrate the capability of our approach to generate MRs and EMRs that are both comprehensible and pertinent for testing purposes.
- A. Fioraldi, D. C. Maier, H. Eißfeldt, and M. Heuse, “AFL++ : Combining incremental steps of fuzzing research,” in WOOT, 2020, pp. 1–12.
- G. Fraser and A. Arcuri, “EvoSuite: automatic test suite generation for object-oriented software,” in ESEC/FSE, 2011, pp. 416–419.
- E. T. Barr, M. Harman, P. McMinn, M. Shahbaz, and S. Yoo, “The oracle problem in software testing: A survey,” IEEE TSE, vol. 41, no. 5, pp. 507–525, 2015.
- T. Y. Chen, F.-C. Kuo, H. Liu, P.-L. Poon, D. Towey, T. H. Tse, and Z. Q. Zhou, “Metamorphic testing: A review of challanges and opportunities,” ACM Computing Surveys, vol. 51, no. 1, 2018.
- Z. Q. Zhou, S. Xiang, and T. Y. Chen, “Metamorphic Testing for Software Quality Assessment: A Study of Search Engines,” IEEE TSE, vol. 42, no. 3, pp. 260–280, 2016.
- N. B. Chaleshtari, F. Pastore, A. Goknil, and L. C. Briand, “Metamorphic testing for web system security,” IEEE TSE, vol. 49, no. 6, pp. 3430–3471, 2023.
- J. Ayerdi, S. Segura, A. Arrieta, G. Sagardui, and M. Arratibel, “QoS-aware metamorphic testing: An elevation case study,” in ISSRE, 2020, pp. 104–114.
- J. Zhang, J. Chen, D. Hao, Y. Xiong, B. Xie, L. Zhang, and H. Mei, “Search-based inference of polynomial metamorphic relations,” in ASE, 2014, p. 701–712.
- Y. Zacchia Lun, A. D’Innocenzo, F. Smarra, I. Malavolta, and M. Domenica Di Benedetto, “State of the art of cyber-physical systems security: An automatic control perspective,” JSS, vol. 149, pp. 174–216, 2019.
- J. Ayerdi, V. Terragni, A. Arrieta, P. Tonella, G. Sagardui, and M. Arratibel, “Generating metamorphic relations for cyber-physical systems with genetic programming: An industrial case study,” in ESEC/FSE, 2021, p. 1264–1274.
- Q.-H. Luu, H. Liu, and T. Y. Chen, “Can ChatGPT advance software testing intelligence? An experience report on metamorphic testing,” 2023.
- Y. Zhang, D. Towey, and M. Pike, “Automated metamorphic-relation generation with chatgpt: An experience report,” in COMPSAC, 2023, pp. 1780–1785.
- J. Wang, Y. Huang, C. Chen, Z. Liu, S. Wang, and Q. Wang, “Software testing with large language models: Survey, landscape, and vision,” 2024.
- Open AI, “Chatgpt,” https://openai.com/blog/chatgpt.
- P. X. Mai, F. Pastore, A. Goknil, and L. Briand, “Metamorphic security testing for web systems,” in ICST, 2020, pp. 186–197.
- Y. Song, T. Wang, P. Cai, S. K. Mondal, and J. P. Sahoo, “A comprehensive survey of few-shot learning: Evolution, applications, challenges, and opportunities,” ACM Computing Surveys, vol. 55, no. 13s, jul 2023.
- S. Y. Shin, F. Pastore, and D. Bianculli, “Replication package,” https://figshare.com/s/dbb113de8d75da0c6b46.