Generating executable oracles to check conformance of client code to requirements of JDK Javadocs using LLMs
Not on the map. Why?
Abstract (arXiv)
Software testing remains the most widely used methodology for validating quality of code. However, effectiveness of testing critically depends on the quality of test suites used. Test cases in a test suite consist of two fundamental parts: (1) input values for the code under test, and (2) correct checks for the outputs it produces. These checks are commonly written as assertions, and termed test oracles. The last couple of decades have seen much progress in automated test input generation, e.g., using fuzzing and symbolic execution. However, automating test oracles remains a relatively less explored problem area. Indeed, a test oracle by its nature requires knowledge of expected behavior, which may only be known to the developer and may not not exist in a formal language that supports automated reasoning. Our focus in this paper is automation of test oracles for clients of widely used Java libraries, e.g., java.lang and java.util packages. Our key insight is that Javadocs that provide a rich source of information can enable automated generation of test oracles. Javadocs of the core Java libraries are fairly detailed documents that contain natural language descriptions of not only how the libraries behave but also how the clients must (not) use them. We use large language models as an enabling technology to embody our insight into a framework for test oracle automation, and evaluate it experimentally. Our experiments demonstrate that LLMs can generate oracles for checking normal and exceptional behaviors from Javadocs, with 98.8% of these oracles being compilable and 96.4% accurately reflecting intended properties. Even for the few incorrect oracles, errors are minor and can be easily corrected with the help of additional comment information generated by the LLMs.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 20 of its 47 references that are in the map. First posted on arXiv 4 Nov 2024.
Builds on
20 of 47 references.
References · 20
- 2023Are Emergent Abilities of Large Language Models a Mirage?cited by 523
- 2023Using an LLM to Help With Code Understandingcited by 228
- 2023Software Testing with Large Language Models: Survey, Landscape, and Visioncited by 166
- 2022Prompting Decision Transformer for Few-Shot Policy Generalizationcited by 146
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 138
- 2024Make Your LLM Fully Utilize the Contextcited by 119
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2024Rethinking LLM Memorization through the Lens of Adversarial Compressioncited by 94
- 2024Aligning LLM Agents by Learning Latent Preference from User Editscited by 69
- 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
- 2022Interactive Code Generation via Test-Driven User-Intent Formalizationcited by 50
- 2020On Learning Meaningful Assert Statements for Unit Test Casescited by 42
8 more
- 2016A Survey of Symbolic Execution Techniquescited by 36
- 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
- 2023When do you need Chain-of-Thought Prompting for ChatGPT?cited by 35
- 2024TOGLL: Correct and Strong Test Oracle Generation with LLMscited by 24
- 2023Neural-Based Test Oracle Generation: A Large-scale Evaluation and Lessons Learnedcited by 9
- 2021Using Machine Learning to Generate Test Oracles: A Systematic Literature Reviewcited by 7
- 2023Assessing Evaluation Metrics for Neural Test Oracle Generationcited by 7
- 2021Formal Verification of Quantum Programs: Theory, Tools and Challengescited by 4
Built on by
Citing papers per year: 2025: 4; 2026: 2.
6 papers.
- 2025On the Effectiveness of Large Language Models in Writing Alloy Formulascited by 7
- 2025CASCADE: LLM-Powered JavaScript Deobfuscator at Googlecited by 5
- 2025OBsmith: LLM-Powered JavaScript Obfuscator Testingcited by 2
- 2026Semantic Voting: Execution-Grounded Consensus for LLM Code Generationcited by 1
- 2025APRIL: API Synthesis with Automatic Prompt Optimization and Reinforcement Learningcited by 0
- 2026Sketch-and-Verify: Structured Inference-Time Scaling via Program Sketchingcited by 0
- 2026Semantic Voting: Execution-Grounded Consensus for LLM Code Generation9 May 2026
- 2026Sketch-and-Verify: Structured Inference-Time Scaling via Program Sketching9 May 2026
- 2025OBsmith: LLM-Powered JavaScript Obfuscator Testing11 Oct 2025
- 2025APRIL: API Synthesis with Automatic Prompt Optimization and Reinforcement Learning29 Aug 2025
- 2025CASCADE: LLM-Powered JavaScript Deobfuscator at Google23 Jul 2025
- 2025On the Effectiveness of Large Language Models in Writing Alloy Formulas21 Feb 2025