arrow
返回

FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categories and Test Code Repair

delete2024-12-01
delete0
delete
OA
AI
S
Sakina Fatima *
H
Hadi Hemmati
L
Lionel Briand
DOI:10.1109/TSE.2024.3472476delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
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.
Keyword:
Codes
Predictive models
Maintenance engineering
Analytical models
Production
Large language models
Java
Few shot learning
Python
Manuals
Flaky tests
fix category
test repair
large language models
code models
few shot learning
software testing

期刊

IEEE Transactions on Software Engineering 封面图
IEEE Transactions on Software Engineering
IF:
5.6
论文数:
2.9K
被引数:
1.1W

机构

Y
york university - canada
学者数:
8.3K
论文数: 9.0K
被引数: 10
U
University of Ottawa
学者数:
3.5W
论文数: 3.1W
被引数: 3.8W
引用论文

引用论文

716 PHASE III STUDY OF INTERMITTENT MAB VS CONTINUOS MAB
err2011-04-01
err0
PREAI
errFernando M. Calais da Silva; Fernando Calais da Silva; Aldo Bono; Peter Whelan; Maurizio Brausi; Anton Queimadelos; Jose Portillo; Ziya Kirkali
err分享
err收藏
Towards a wireless and fully-implantable ECoG system
err2013-06-01
err0
PREAI
errE. Tolstosheeva; J. Hoeffmann; J. Pistor; D. Rotermund; T. Schellenberg; D. Boll; T. Hertzberg; V. Gordillo-Gonzalez; S. Mandon; D. Peters-Drolshagen; M. Schneider; K. Pawelzik; A. Kreiter; S. Paul; W. Lang
err分享
err收藏
err分享
err收藏
Challenges to Integrate CCS into Low Carbon Electricity Markets
err2014-01-01
err0
errOAAI
errFilip Johnsson; Mikael Odenberger; Lisa Göransson
err分享
err收藏
err分享
err收藏
err分享
err收藏
err分享
err收藏
学者 查看更多内容