arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.03420cs.SEcs.AI

使用模型推断搜索启发式方法为 REST API 自动生成测试用例

Automated Test-Case Generation for REST APIs Using Model Inference Search Heuristic

Delft University of Technology(代尔夫特理工大学)

Clinton Cao, Annibale Panichella, Sicco Verwer

AI总结:

针对进化算法在微服务系统级测试中单元级启发式方法的局限,提出基于实时自动机学习的搜索启发式方法MISH,通过日志事件流捕获系统级行为以指导测试用例生成,在六个真实基准应用中评估取得良好效果。

摘要:

微服务架构风格的日益流行导致对这些系统量身定制的自动化测试方法的需求不断增长。EvoMaster 是一款最先进的工具,它使用进化算法(EAs)自动为微服务的 REST API 生成测试用例。这些 EAs 的一个局限性是使用了单元级搜索启发式方法,例如分支距离,它们专注于细粒度的代码覆盖,可能无法有效捕捉系统级测试所特有的复杂、相互关联的行为。为了解决这一局限性,我们提出了一种新的搜索启发式方法(MISH),它使用实时自动机学习来指导测试用例生成过程。我们通过从同一系统内不同微服务输出的日志事件流中学习自动机,来捕获测试用例所表现出的顺序调用模式。因此,MISH 学习了系统级行为的表示,使我们能够根据测试用例在推断自动机中遍历的路径来定义其适应度。我们在六个真实世界的基准微服务应用上实证评估了 MISH 的有效性,并将其与用于测试 REST API 的最先进技术 MOSA 进行了比较。我们的评估显示了使用 MISH 指导 EvoMaster 内自动测试用例生成的可喜结果。

英文摘要:

The rising popularity of the microservice architectural style has led to a growing demand for automated testing approaches tailored to these systems. EvoMaster is a state-of-the-art tool that uses Evolutionary Algorithms (EAs) to automatically generate test cases for microservices' REST APIs. One limitation of these EAs is the use of unit-level search heuristics, such as branch distances, which focus on fine-grained code coverage and may not effectively capture the complex, interconnected behaviors characteristic of system-level testing. To address this limitation, we propose a new search heuristic (MISH) that uses real-time automaton learning to guide the test case generation process. We capture the sequential call patterns exhibited by a test case by learning an automaton from the stream of log events outputted by different microservices within the same system. Therefore, MISH learns a representation of the systemwide behavior, allowing us to define the fitness of a test case based on the path it traverses within the inferred automaton. We empirically evaluate MISH's effectiveness on six real-world benchmark microservice applications and compare it against a state-of-the-art technique, MOSA, for testing REST APIs. Our evaluation shows promising results for using MISH to guide the automated test case generation within EvoMaster.

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

↑