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.
翻译:微服务架构风格的日益普及,催生了针对此类系统定制化自动化测试方法的需求。EvoMaster是一种利用进化算法(EAs)为微服务REST API自动生成测试用例的先进工具。现有进化算法的局限在于采用单元级搜索启发式策略(如分支距离),这类策略侧重于细粒度代码覆盖,可能无法有效捕捉系统级测试中特有的复杂互联行为。为突破此局限,我们提出一种新型搜索启发式方法(MISH),该方法通过实时自动机学习来引导测试用例生成过程。我们通过从同一系统内不同微服务输出的日志事件流中学习自动机,从而捕获测试用例展现的序列调用模式。因此,MISH能够学习系统级行为的表征,使我们能够根据测试用例在推断自动机中遍历的路径来定义其适应度。我们在六个实际基准微服务应用上实证评估MISH的有效性,并将其与当前先进的REST API测试技术MOSA进行对比。评估结果表明,使用MISH引导EvoMaster中的自动化测试用例生成具有显著潜力。