RESTOR: Automated Test Oracle Generation for RESTful APIs via Reinforcement Learning
Xun Zhou, Zhen Dong, Mingyu Ren, Qiang Li, JunJie Li, Sifan Wang, Xiaolong Yu, Chaofeng Sha,
Fudan University · ByteDance (China)
Key points
From the paper's conclusion- RESTOR is a framework that generates executable test assertions from a single observed request-response pair in a black-box setting using reinforcement learning.
- RESTOR utilizes a novel data augmentation pipeline to fine-tune a lightweight Large Language Model (LLM) via Group Relative Policy Optimization (GRPO) to internalize testing 'common sense'.
- RESTOR significantly outperforms prompt-engineered baselines and generalist models, achieving an F 1 score of 85.42% and raising the adoption rate of automatically generated test cases to over 96%.
Abstract
Modern REST API testing faces a critical challenge in defining reliable test oracles, particularly in agile industrial environments where formal specifications (e.g., OpenAPI) are frequently missing or outdated, and historical execution logs are unavailable for newly deployed endpoints. In this paper, we present RESTOR (Reinforcement Enhanced Single-Traffic Oracle generator for REST APIs), a framework that generates executable test assertions from a single observed request-response pair in a black-box setting. Unlike existing approaches that rely on rule-based templates or massive training logs, RESTOR utilizes a novel data augmentation pipeline to fine-tune a lightweight Large Language Model (LLM) via Group Relative Policy Optimization (GRPO). This training process enables the model to internalize testing ”common sense” by optimizing a reward function that jointly encourages: (i) the selection of stable, semantically meaningful fields for validation and the avoidance of dynamic noise (e.g., timestamps or trace IDs); (ii) the generation of robust assertions that withstand logic variations. We evaluate RESTOR on an industrial dataset comprising over 2,300 API traces across 246 real-world services. Comprehensive experiments demonstrate that RESTOR significantly outperforms prompt-engineered baselines and generalist models, achieving a superior F 1 score of 85.42% in key field identification and increasing the proportion of semantically accurate assertions. Furthermore, deployment in a production CI/CD workflow at ByteDance confirms its practical value: the system raised the adoption rate of automatically generated test cases from 74.1% to over 96%, substantially reducing manual Quality Assurance (QA) effort while ensuring high execution stability.
Read the paper
Discussion · 1
Science Skim's AI key points, plus readers' public thoughts
- RESTOR is a framework that generates executable test assertions from a single observed request-response pair in a black-box setting using reinforcement learning.
- RESTOR utilizes a novel data augmentation pipeline to fine-tune a lightweight Large Language Model (LLM) via Group Relative Policy Optimization (GRPO) to internalize testing 'common sense'.
- RESTOR significantly outperforms prompt-engineered baselines and generalist models, achieving an F 1 score of 85.42% and raising the adoption rate of automatically generated test cases to over 96%.
Readers' thoughts
No reader thoughts yet.
Related papers
- EnterpriseSynth: Zero-Execution SFT and Evaluation Data from OpenAPI SpecsarXiv · 2026
- LogicHunter: Testing LLM Agent Frameworks with an Agentic OracleProceedings of the ACM on software engineering. · 2026
- ReqTestAgent: execution-grounded language-model agents for acceptance testing under requirement ambiguity.Frontiers in artificial intelligence · 2026
- Industrial Practice of LLM-Based Test Case Carving and Assertion Generation (Experience Paper)Proceedings of the ACM on Software Engineering · 2026
- Invariant-Aware Harness Enforcement to Protect LLM Agents from Silent API FailuresarXiv · 2026
- VERSE: Verified Self-Evolving Optimizer for Agent HarnessesarXiv · 2026