Can We Classify Flaky Tests Using Only Test Code? An LLM-Based Empirical Study
Alexander Berndt, Vekil Bekmyradov, Rainer Gemulla, Marcus Kessel, Thomas Bach, Sebastian Baltes

TL;DR
This study investigates whether large language models can classify flaky tests solely based on test code, finding that they perform only marginally better than random guessing and highlighting the need for additional context.
Contribution
The paper empirically evaluates the effectiveness of pre-trained LLMs in classifying flaky tests using only test code, revealing limitations and guiding future research directions.
Findings
LLMs struggle to classify flaky tests from code alone
Best models perform marginally better than random chance
Test code alone often lacks sufficient information for classification
Abstract
Flaky tests yield inconsistent results when they are repeatedly executed on the same code revision. They interfere with automated quality assurance of code changes and hinder efficient software testing. Previous work evaluated approaches to train machine learning models to classify flaky tests based on identifiers in the test code. However, the resulting classifiers have been shown to lack generalizability, hindering their applicability in practical environments. Recently, pre-trained Large Language Models (LLMs) have shown the capability to generalize across various tasks. Thus, they represent a promising approach to address the generalizability problem of previous approaches. In this study, we evaluated three LLMs (two general-purpose models, one code-specific model) using three prompting techniques on two benchmark datasets from prior studies on flaky test classification.…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Machine Learning and Algorithms
