FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categories and Test Code Repair
Not on the map. Why?
Abstract (arXiv)
Flaky tests are problematic because they non-deterministically pass or fail for the same software version under test, causing confusion and wasting development effort. While machine learning models have been used to predict flakiness and its root causes, there is much less work on providing support to fix the problem. To address this gap, in this paper, we focus on predicting the type of fix that is required to remove flakiness and then repair the test code on that basis. We do this for a subset of flaky tests where the root cause of flakiness is in the test itself and not in the production code. One key idea is to guide the repair process with additional knowledge about the test's flakiness in the form of its predicted fix category. Thus, we first propose a framework that automatically generates labeled datasets for 13 fix categories and trains models to predict the fix category of a flaky test by analyzing the test code only. Our experimental results using code models and few-shot learning show that we can correctly predict most of the fix categories. To show the usefulness of such fix category labels for automatically repairing flakiness, we augment the prompts of GPT-3.5 Turbo, a Large Language Model (LLM), with such extra knowledge to request repair suggestions. The results show that our suggested fix category labels, complemented with in-context learning, significantly enhance the capability of GPT-3.5 Turbo in generating fixes for flaky tests. Based on the execution and analysis of a sample of GPT-repaired flaky tests, we estimate that a large percentage of such repairs (roughly between 51% and 83%) can be expected to pass. For the failing repaired tests, on average, 16% of the test code needs to be further changed for them to pass.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 30 of its 92 references that are in the map. First posted on arXiv 21 Jun 2023.
Builds on
30 of 92 references.
References · 30
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2015FaceNet: A Unified Embedding for Face Recognition and Clusteringcited by 2,849
- 2023A Survey of Large Language Modelscited by 2,576
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2022Reasoning with Language Model Prompting: A Surveycited by 252
- 2020ADAHESSIAN: An Adaptive Second Order Optimizer for Machine Learningcited by 202
- 2022Practical Program Repair in the Era of Large Pre-trained Language Modelscited by 133
18 more
- 2021Examining Zero-Shot Vulnerability Repair with Large Language Modelscited by 105
- 2022Less Training, More Repairing Please: Revisiting Automated Program Repair via Zero-shot Learningcited by 76
- 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
- 2023ChatGPT Prompt Patterns for Improving Code Quality, Refactoring, Requirements Elicitation, and Software Designcited by 66
- 2022Out of the BLEU: how should we assess quality of the Code Generation models?cited by 65
- 2018A Twofold Siamese Network for Real-Time Object Trackingcited by 62
- 2021Applying CodeBERT for Automated Program Repair of Java Simple Bugscited by 44
- 2023Improving ChatGPT Prompt for Code Generationcited by 28
- 2023An Empirical Comparison of Pre-Trained Models of Source Codecited by 25
- 2021Flakify: A Black-Box, Language Model-based Predictor for Flaky Testscited by 11
- 2019Understanding Flaky Tests: The Developer's Perspectivecited by 8
- 2021A Qualitative Study on the Sources, Impacts, and Mitigation Strategies of Flaky Testscited by 4
- 2021What is the Vocabulary of Flaky Tests? An Extended Replicationcited by 3
- 2022A Survey on How Test Flakiness Affects Developers and What Support They Need To Address Itcited by 2
- 2023Practical Flaky Test Prediction using Common Code Evolution and Test History Datacited by 2
- 2019FlakiMe: Laboratory-Controlled Test Flakiness Impact Assessment. A Case Study on Mutation Testing and Program Repaircited by 1
- 2022An Empirical Study of Flaky Tests in JavaScriptcited by 1
- 2023Time-based Repair for Asynchronous Wait Flaky Tests in Web Testingcited by 1
Built on by
Citing papers per year: 2024: 1; 2025: 3; 2026: 2.
6 papers.
- 2025Large Language Models for Software Testing: A Research Roadmapcited by 2
- 2026Predicting Intermittent Job Failure Categories for Diagnosis Using Few-Shot Fine-Tuned Language Modelscited by 1
- 2024FlaKat: A Machine Learning-Based Categorization Framework for Flaky Testscited by 0
- 2025An Empirical Study of Sample Selection Strategies for Large Language Model Repaircited by 0
- 2025FlakyGuard: Automatically Fixing Flaky Tests at Industry Scalecited by 0
- 2026Automating Detection and Root-Cause Analysis of Flaky Tests in Quantum Softwarecited by 0
- 2026Automating Detection and Root-Cause Analysis of Flaky Tests in Quantum Software9 Mar 2026
- 2026Predicting Intermittent Job Failure Categories for Diagnosis Using Few-Shot Fine-Tuned Language Models29 Jan 2026
- 2025FlakyGuard: Automatically Fixing Flaky Tests at Industry Scale18 Nov 2025
- 2025An Empirical Study of Sample Selection Strategies for Large Language Model Repair23 Oct 2025
- 2025Large Language Models for Software Testing: A Research Roadmap29 Sep 2025
- 2024FlaKat: A Machine Learning-Based Categorization Framework for Flaky Tests1 Mar 2024