arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.01874cs.SE
收藏

使用大型语言模型的自动化控制逻辑测试用例生成

Automated Control Logic Test Case Generation using Large Language Models

Heiko Koziolek, Virendra Ashiwal, Soumyadip Bandyopadhyay, Chandrika K R

AI总结:

本文提出利用大型语言模型自动生成PLC控制逻辑测试用例,实验表明该方法快速易用且对中低复杂度程序语句覆盖率高,但生成的断言仍需人工修正。

摘要:

在工业自动化中测试PLC和DCS控制逻辑既费力又具有挑战性,因为合适的测试用例往往复杂且难以制定。研究人员此前提出了几种针对PLC软件的自动化测试用例生成方法,应用了符号执行和基于搜索的技术。这些方法通常需要形式化规范并对程序进行机械分析,可能发现特定的编程错误,但有时会遭受状态空间爆炸问题,并且无法处理相当非形式化的规范。我们提出了一种新颖的PLC测试用例自动生成方法,该方法查询大型语言模型(LLM)来为提示中提供的代码合成测试用例。使用来自OSCAT自动化库的十个开源功能块进行的实验表明,该方法快速、易于使用,并且对于中低复杂度的程序可以产生具有高语句覆盖率的测试用例。然而,我们也发现LLM生成的测试用例在许多情况下存在错误断言,仍然需要人工调整。

英文摘要:

Testing PLC and DCS control logic in industrial automation is laborious and challenging since appropriate test cases are often complex and difficult to formulate. Researchers have previously proposed several automated test case generation approaches for PLC software applying symbolic execution and search-based techniques. Often requiring formal specifications and performing a mechanical analysis of programs, these approaches may uncover specific programming errors but sometimes suffer from state space explosion and cannot process rather informal specifications. We proposed a novel approach for the automatic generation of PLC test cases that queries a Large Language Model (LLM) to synthesize test cases for code provided in a prompt. Experiments with ten open-source function blocks from the OSCAT automation library showed that the approach is fast, easy to use, and can yield test cases with high statement coverage for low-to-medium complex programs. However, we also found that LLM-generated test cases suffer from erroneous assertions in many cases, which still require manual adaption.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑