Unit tests play a key role in ensuring the correctness of software. However, manually creating unit tests is a laborious task, motivating the need for automation. Large Language Models (LLMs) have recently been applied to this problem, utilizing additional training or few-shot learning on examples of existing tests. This paper presents a large-scale empirical evaluation on the effectiveness of LLMs for automated unit test generation without additional training or manual effort, providing the LLM with the signature and implementation of the function under test, along with usage examples extracted from documentation. We also attempt to repair failed generated tests by re-prompting the model with the failing test and error message. We implement our approach in TestPilot, a test generation tool for JavaScript that automatically generates unit tests for all API functions in an npm package. We evaluate TestPilot using OpenAI's gpt3.5-turbo LLM on 25 npm packages with a total of 1,684 API functions. The generated tests achieve a median statement coverage of 70.2% and branch coverage of 52.8%, significantly improving on Nessie, a recent feedback-directed JavaScript test generation technique, which achieves only 51.3% statement coverage and 25.6% branch coverage. We also find that 92.8% of TestPilot's generated tests have no more than 50% similarity with existing tests (as measured by normalized edit distance), with none of them being exact copies. Finally, we run TestPilot with two additional LLMs, OpenAI's older code-cushman-002 LLM and the open LLM StarCoder. Overall, we observed similar results with the former (68.2% median statement coverage), and somewhat worse results with the latter (54.0% median statement coverage), suggesting that the effectiveness of the approach is influenced by the size and training set of the LLM, but does not fundamentally depend on the specific model.
Automated Generation of Massive Reasonable Empirical Theorems by Forward Reasoning Based on Strong Relevant Logics -- A Solution to the Problem of LLM Pre-training Data Exhaustion
A System for Automated Unit Test Generation Using Large Language Models and Assessment of Generated Test Suites
Polytechnic University of Bari \& Wideverse Bari, Italy;Polytechnic University of Bari Bari, Italy;Independent Researcher;University of Bari Bari, Italy
Citation Discipline in Spec-Driven Development: A Cross-Model Empirical Study of Output Determinism and Automated Hallucination Detection in LLM-Generated Code
SPARC: Scenario Planning and Reasoning for Automated C Unit Test Generation
Bangladesh University of Engineering and Technology(孟加拉工程科技大学);National Taiwan University(台湾国立大学);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)
Hackers or Hallucinators? A Comprehensive Analysis of LLM-Based Automated Penetration Testing
School of Cyber Science and Engineering, Sichuan University(四川大学网络空间安全学院);Institute for Network Sciences and Cyberspace, Tsinghua University(清华大学网络科学与网络空间研究院);College of Computing and Data Science, Nanyang Technological University(南洋理工大学计算与数据科学学院);National University of Singapore(新加坡国立大学);College of Electronic Engineering, National University of Defense Technology(国防科技大学电子工程学院);Gaoling School of Artificial Intelligence, Renmin University of China(中国人民大学高瓴人工智能学院);School of Artificial Intelligence, Wuhan University(武汉大学人工智能学院)
Can LLM-Generated Textual Explanations Enhance Model Classification Performance? An Empirical Study
Technical University of Munich, School of Computation, Information and Technology, Department of Computer Science, Munich, Germany(慕尼黑技术大学,计算、信息与技术学院,计算机科学系,德国慕尼黑)
An Automated Framework for Extracting Reachable Attack Chains from Cyber Threat Intelligence Reports
Guangdong Provincial Key Laboratory of Novel Security Intelligence Technologies(广东新型安全情报技术重点实验室);School of Computer Science and Technology(计算机科学与技术学院);Harbin Institute of Technology(哈尔滨工业大学);New Network Research Department(新网络研究部);Peng Cheng Laboratory(鹏城实验室);Great Bay University(大湾区大学)
Maintenance of Automated Test Suites in Industry: An Empirical study on Visual GUI Testing
验证与确认(Verification and Validation,V&V)活动在实践中占软件系统总开发成本的20%到50%。测试自动化被提出来降低这些V&V成本,但现有的研究只提供了有限的经验数据,从工业实践中的维护成本的自动化测试和影响这些成本的因素。特别是,这些成本和因素对于基于GUI的自动化测试是未知的。目的:本文通过分析与工业实践中基于GUI的自动化测试维护相关的成本和因素,解决了这种知识的缺乏。方法:在两个公司,西门子和萨博,实证研究报告的采访,和实证工作,可视化GUI测试进行获取数据的技术的维护成本和可行性。结果:观察到13个因素,影响维修,如测试人员的知识/经验和测试用例的复杂性。此外,统计分析表明,开发新的测试脚本比维护成本更高,但频繁的维护比不频繁的大爆炸维护成本更低。此外,成本模型,在以前的工作的基础上,提出了估计的时间,以积极的投资回报率(ROI)的测试自动化相比,手动测试。结论:它的结论是,测试自动化可以降低一个项目的整体软件开发成本,同时也对软件质量有积极的影响。然而,维护成本仍然是相当可观的,公司目前花在手动测试上的时间越少,在自动化之后达到积极的、经济的ROI之前需要的时间就越多。
Orchestrating Black-Box Schema Converters: An Empirical Study of Automated, Quality-Ranked Conversion Across Heterogeneous Schema Languages
Institute for Parallel and Distributed Systems, University of Stuttgart(斯图加特大学并行与分布式系统研究所);Institute of Biochemistry and Technical Biochemistry, University of Stuttgart(斯图加特大学生化与技术生物化学研究所)
An Empirical Analysis of the Influence of Fault Space on Search-Based Automated Program Repair
自动程序修复(Automated program repair,APR)已经引起了广泛的研究关注,并且已经提出了各种技术。基于搜索的APR是这些技术中最重要的类别之一。现有的研究集中在设计有效的变异算子和搜索算法,以更好地找到正确的补丁。尽管有各种努力,这些技术的有效性仍然受到搜索空间爆炸问题的限制。这个问题的关键因素之一是现有研究报告的故障空间的质量。这促使我们研究故障空间的重要性,成功地找到一个正确的补丁。我们的实证研究旨在回答三个问题。故障空间是否与基于搜索的APR的性能显著相关?如果是,在应用昂贵的APR技术之前,是否有任何指示性测量来近似故障空间的准确性?有没有自动化的方法可以提高故障空间的精度?我们观察到,故障空间的准确性影响基于搜索的APR技术的有效性和效率,例如,即使正确的补丁在搜索空间中,当实际定位位置的等级低于10时,GenProg的失败率也可能高达$60\%$。此外,GenProg能够找到更多的正确补丁,并与更少的尝试时,给定的故障空间具有更高的精度。我们还发现,负突变覆盖率,这是在这项研究中被设计来衡量一个测试套件的能力,杀死突变的语句执行失败的测试,是最具指示性的测量,以估计基于搜索的APR的效率。最后,我们证实,自动生成的测试用例可以帮助提高故障空间的准确性,并进一步提高基于搜索的APR技术的性能。
An Empirical Study on the Potential of LLMs in Automated Software Refactoring
Beijing Institute of Technology(北京理工大学);Peking University(北京大学);University of Cincinnati(辛辛那提大学);National Innovation Institute of Defense Technology(国防科技大学创新研究院)