AI 中文总结
针对微服务系统回归测试因文档问题面临的挑战,提出NL2Test工具,通过自然语言描述和流量捕获生成可执行API回归测试,经大语言模型和确定性算法完成测试用例提取与断言生成等任务,在工业场景中效果良好,减少人工并提升自动化程度。
AI 中文摘要
微服务系统的企业回归测试常受文档不完整或过时的限制。QA工程师常依赖实际执行流量重建业务场景,但将原始流量转化为具有稳定验证逻辑的可重放回归测试既费力又易出错。本文提出NL2Test,一种端到端方法和工具,可从自然语言场景描述和执行场景时记录的流量捕获生成可执行的API回归测试。NL2Test解决两个耦合任务:测试用例提取,提取最小可重放请求序列并重建数据依赖;断言生成,生成与业务意图一致的断言。为提高可靠性,NL2Test使用大语言模型进行语义解释和受限代码合成,使用确定性算法进行请求过滤、通过值一致性确认依赖和断言路径验证。我们在从一家大型面向消费者的互联网公司提取的51个工业回归场景上评估NL2Test。NL2Test实现了82.4%(42/51)的确切匹配率,在允许少量后期编辑的情况下,98.0%(50/51)的场景中生成了功能可用的草案。在2025年3月开始的9个月生产部署中,NL2Test生成了3196个测试用例,总体代码采用率为85.4%。这些结果表明,带有确定性护栏的流量驱动生成可以在提高复杂微服务环境中的回归自动化的同时,大幅减少人工工作量。
英文摘要
Enterprise regression testing for microservice systems is often constrained by incomplete or outdated documentation. In practice, QA engineers frequently rely on real execution traffic to reconstruct business scenarios; however, turning raw traffic into replayable regression tests with stable validation logic remains labor-intensive and error-prone. This paper presents NL2Test, an end-to-end approach and tool that generates executable API regression tests from (i) a natural-language scenario description and (ii) a traffic capture recorded while executing the scenario. NL2Test addresses two coupled tasks: test case carving, which extracts a minimal replayable request sequence and reconstructs data dependencies so that dynamic values are bound from their responses rather than hard-coded; and assertion generation, which produces assertions aligned with business intent while avoiding non-deterministic fields and hallucinated paths. To improve reliability, NL2Test uses LLMs for semantic interpretation and constrained code synthesis, and uses deterministic algorithms for request filtering, dependency confirmation via value consistency, and assertion-path validation. We evaluate NL2Test on 51 industrial regression scenarios extracted from a large consumer-facing Internet company. NL2Test achieves an exact-match rate of 82.4% (42/51), and produces a functionally usable draft in 98.0% (50/51) of scenarios when allowing minor post-edits. In a 9-month production deployment starting in March 2025, NL2Test generated 3,196 test cases with an overall code adoption rate of 85.4%. These results indicate that traffic-grounded generation with deterministic guardrails can substantially reduce manual effort while improving regression automation in complex microservice environments.
Comments23 pages, 6 figures, Proceedings of the 35th ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA 2026)
DOI:10.1145/3832099