Unit testing is vital in software development. Typically, a unit test consists of a test prefix and a test oracle which captures the developer's intended behaviour. Traditional test generation tools (e.g. Randoop and Evosuite) often produce oracles that mirror the program's actual behavior rather than the expected one, limiting their ability to automatically detect bugs as users must manually verify if the generated assertions are correct. Recent approaches leverage Large Language Models (LLMs), trained on vast datasets, to generate developer-like code and test cases. Although successful in generating tests, the question of whether such LLM-generated oracles can automatically find bugs, i.e., expected software behavior, remains unanswered. We conduct a controlled experiment to answer this question, by studying LLMs on two tasks, namely, test oracle classification and generation, and assessing whether LLM oracles capture the actual or the expected behavior. The study includes test cases and oracles written by developers and automatically generated for 24 Java repositories. Our findings show that LLM-based test generation approaches mainly capture the actual program behavior making bug detection difficult. We also find that LLMs are better at generating oracles than classifying them. Notably, LLM-generated oracles have a higher fault detection potential than the Evosuite ones.
School of Computer Science, Peking University(北京大学计算机学院);Institute for Artificial Intelligence, Peking University(北京大学人工智能研究院);School of Software, Tsinghua University(清华大学软件学院)
LLM-Based Invariant Testing for Software Functional Bugs
Northeastern University(东北大学);University of California, Davis(加州大学戴维斯分校);Southern University of Science and Technology(南方科技大学);The University of Hong Kong(香港大学)
Rise From The Ashes: LLM-based Static Analysis for Deep Learning Framework Bugs
State Key Laboratory for Novel Software Technology, Nanjing University(南京大学软件新技术国家重点实验室);School of Artificial Intelligence and Computer Science, Nantong University(南通大学人工智能与计算机学院);College of Computer Science and Technology/College of Software, Nanjing University of Aeronautics and Astronautics(南京航空航天大学计算机科学与技术学院/软件学院);Beijing Academy of Artificial Intelligence(北京智源人工智能研究院)
Spotting Setting-Related UI Display Bugs in Android Apps
School of Informatics (National Characteristic Demonstration Software School), Xiamen University(厦门大学信息学院(国家示范性软件学院));Fujian Engineering Research Center of High-Performance Intelligent Computing Systems(福建省高性能智能计算系统工程研究中心)
PatchGuru: Patch Oracle Inference from Natural Language Artifacts
Singapore University of Technology and Design(新加坡科技设计大学);University of Melbourne(墨尔本大学);Imperial College London(帝国理工学院);CISPA Helmholtz Center for Information Security(CISPA赫尔霍兹信息安全中心)
Characterizing Real-World Bugs in Tile Programs for Automated Bug Detection
University of Texas at Dallas(达拉斯大学);Institute of Systems for Advanced Computing, Fudan University(复旦大学高级计算系统研究所);Beijing Tongming Lake Information Technology Application Innovation Center(北京通明湖信息技术应用创新中心);Shanghai Institute of Systems for Open Computing(上海开放计算系统研究所);Key Lab of HCST (PKU), MOE(北京大学计算机辅助设计与图形学教育部重点实验室;计算机科学系,北京大学);SCS, Peking University
LLM-Powered Test Case Generation for Detecting Bugs in Plausible Programs
Peking University(北京大学);Nanyang Technological University(南洋理工大学);King’s College London(伦敦国王学院);University College London(伦敦大学学院);National Key Laboratory of Data Space Technology and System(数据空间技术与系统国家重点实验室)
Beijing Jiaotong University(北京交通大学);Beijing Key Laboratory of Traffic Data Mining and Embodied Intelligence(北京市交通数据挖掘与具身智能重点实验室);Singapore Management University(新加坡管理大学);University College London(伦敦大学学院);University of Luxembourg(卢森堡大学);King’s College London(伦敦国王学院)