RESTOR: Automated Test Oracle Generation for RESTful APIs via Reinforcement Learning
Open Access
- 1 October 2026
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 3 (ISSTA) , 2159-2180
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.Keywords
This publication has 35 references indexed in Scilit:
- SATORI: Static Test Oracle Generation for REST APIs2025
- LLM Based Input Space Partitioning Testing for Library APIs2025
- Adversarial Testing with Reinforcement Learning: A Case Study on Autonomous Driving2024
- Dynamic Graph Neural Networks-Based Alert Link Prediction for Online Service Systems2023
- A comparison of reinforcement learning frameworks for software testing tasksEmpirical Software Engineering, 2023
- Compiler Test-Program Generation via Memoized Configuration Search2023
- FIGCPS: Effective Failure-inducing Input Generation for Cyber-Physical Systems with Deep Reinforcement Learning2021
- EvoSpex: An Evolutionary Algorithm for Learning Postconditions2021
- RESTest: Black-Box Constraint-Based Testing of RESTful Web APIs2020
- RESTler: Stateful REST API Fuzzing2019