检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:李博诺 王博[1] 陈明达 林友芳[1] 江云松[2] 陈睿[2,3] 李鹏宇 LI Bonuo;WANG Bo∗;CHEN Mingda;LIN Youfang;JIANG Yunsong;CHEN Rui;LI Pengyu;无(Beijing Jiaotong University,Beijing 100044,China;Beijing Institute of Control Engineering,Beijing 100094,China;Beijing Sunwise Information Technology Ltd,Beijing 100090,China)
机构地区:[1]北京交通大学,北京100044 [2]北京控制工程研究所,北京100094 [3]北京轩宇信息技术有限公司,北京100090
出 处:《空间控制技术与应用》2025年第1期115-122,共8页Aerospace Control and Application
基 金:国家自然科学基金资助项目(62202040).
摘 要:单元测试用于检验软件单一模块的功能是否正确,是软件开发过程中的重要步骤,可以及时发现代码中的缺陷,提升软件的质量和可信度.由于手动编写单元测试费时费力,经常遗漏覆盖重要的代码逻辑.为此,研究者提出单元测试用例自动生成技术.近来,预训练大语言模型(large language models,LLM)已经广泛应用于代码生成相关任务.然而,当前在重要的系统级编程语言C上,还没有相关工作.为了填补这一空白,本文面向C程序设计并实现了基于LLM的单元测试用例生成方法LLM4CUTCG.该方法结合LLM多智能体交互和程序分析技术,客服了LLM内在问题.为了验证方法效果,收集了125个C语言目标程序,并针对这些程序生成测试用例.实验结果表明,LLM4CUTCG生成的测试行覆盖率为91.71%,测试预言正确率为50.05%.其覆盖率优于传统方法符号执行.Unit testing is used to verify the functionality of individual software modules,making it a crucial step in the software development process.It helps in identifying defects in the code in a timely manner,thereby improving the quality and reliability of the software.Manually writing unit tests is time-consuming and labor-intensive,often missing important code logic.To address this,researchers have proposed techniques for automatic generation of unit tests.Recently,pre-trained large language models(LLM)have been widely applied to tasks related to code generation,and there has been work on generating unit tests for languages such as Java and JavaScript.However,in safety-critical domains such as aerospace,C language programs are predominantly used.To fill this gap,we designed and implemented an LLM-based multi-agent interaction method for generating unit tests for C programs,named LLM4CUTCG.To verify the effectiveness of this method,we constructed 125 target programs without data leakage risks and generated tests for these programs.Experimental results show that the line coverage of the tests generated by LLM4CUTCG is 91.71%,and the assertion correctness rate is 50.05%.The coverage rate outperforms traditional methods such as symbolic execution and fuzz testing.
关 键 词:软件测试 单元测试 测试自动生成 代码自动生成 大语言模型 测试预言
分 类 号:V44[航空宇航科学与技术—飞行器设计]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:18.222.178.70