arXiv:2412.03420cs.SEcs.AI2024-12被引 5

用实时状态机学习提升REST API测试生成效率

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

  • 基于日志流实时构建系统级状态机,指导测试用例搜索
  • 在6个真实微服务上,测试覆盖度较MOSA提升12.7%
  • 适合关注系统级行为验证的测试工程师

微服务架构日益普及,对自动化测试的需求也随之增加。EvoMaster 是一种基于进化算法(EAs)自动生成微服务 REST API 测试用例的先进工具。然而,现有 EAs 依赖单元级搜索启发式(如分支距离),侧重细粒度代码覆盖,难以捕捉系统级复杂交互行为。为此,我们提出一种新型启发式方法 MISH,通过实时状态机学习,从同一系统中多个微服务输出的日志事件流中提取测试用例的序列调用模式。MISH 学习系统级行为表示,并根据测试用例在推断状态机中遍历的路径定义其适应度。我们在六个真实世界微服务基准应用上评估 MISH 的有效性,与最先进的 MOSA 方法进行对比。结果表明,MISH 在 EvoMaster 中引导测试用例生成方面表现优异。

原文摘要 · Abstract (English)

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.

API测试进化算法状态机微服务

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。