Predicting Flaky Tests Categories using Few-Shot Learning

08/31/2022
by   Amal Akli, et al.
0

Flaky tests are tests that yield different outcomes when run on the same version of a program. This non-deterministic behaviour plagues continuous integration with false signals, wasting developers' time and reducing their trust in test suites. Studies highlighted the importance of keeping tests flakiness-free. Recently, the research community has been pushing forward the detection of flaky tests by suggesting many static and dynamic approaches. While promising, those approaches mainly focus on classifying tests as flaky or not and, even when high performances are reported, it remains challenging to understand the cause of flakiness. This part is crucial for researchers and developers that aim to fix it. To help with the comprehension of a given flaky test, we propose FlakyCat, the first approach for classifying flaky tests based on their root cause category. FlakyCat relies on CodeBERT for code representation and leverages a Siamese network-based Few-Shot learning method to train a multi-class classifier with few data. We train and evaluate FlakyCat on a set of 343 flaky tests collected from open-source Java projects. Our evaluation shows that FlakyCat categorises flaky tests accurately, with a weighted F1 score of 70 approach for each category, revealing that Async waits, Unordered collections and Time-related flaky tests are accurately classified, while Concurrency-related flaky tests are more challenging to predict. Finally, to facilitate the comprehension of FlakyCat's predictions, we present a new technique for CodeBERT-based model interpretability that highlights code statements influencing the categorization.

READ FULL TEXT
research
06/21/2023

Black-Box Prediction of Flaky Test Fix Categories Using Language Models

Flaky tests are problematic because they non-deterministically pass or f...
research
07/20/2022

What Made This Test Flake? Pinpointing Classes Responsible for Test Flakiness

Flaky tests are defined as tests that manifest non-deterministic behavio...
research
04/15/2021

On the Use of Mutation in Injecting Test Order-Dependency

Background: Test flakiness is identified as a major issue that compromis...
research
11/05/2021

Discerning Legitimate Failures From False Alerts: A Study of Chromium's Continuous Integration

Flakiness is a major concern in Software testing. Flaky tests pass and f...
research
09/13/2022

Inline Tests

Unit tests are widely used to check source code quality, but they can be...
research
02/18/2023

Practical Flaky Test Prediction using Common Code Evolution and Test History Data

Non-deterministically behaving test cases cause developers to lose trust...
research
05/08/2023

Debugging Flaky Tests using Spectrum-based Fault Localization

Non-deterministically behaving (i.e., flaky) tests hamper regression tes...

Please sign up or login with your details

Forgot password? Click here to reset