Publication Type

Conference Proceeding Article

Version

acceptedVersion

Publication Date

10-2020

Abstract

Flaky tests are tests whose outcomes are non-deterministic. Despite the recent research activity on this topic, no effort has been made on understanding the vocabulary of flaky tests. This work proposes to automatically classify tests as flaky or not based on their vocabulary. Static classification of flaky tests is important, for example, to detect the introduction of flaky tests and to search for flaky tests after they are introduced in regression test suites. We evaluated performance of various machine learning algorithms to solve this problem. We constructed a data set of flaky and non-flaky tests by running every test case, in a set of 64k tests, 100 times (6.4 million test executions). We then used machine learning techniques on the resulting data set to predict which tests are flaky from their source code. Based on features, such as counting stemmed tokens extracted from source code identifiers, we achieved an F-measure of 0.95 for the identification of flaky tests. The best prediction performance was obtained when using Random Forest and Support Vector Machines. In terms of the code identifiers that are most strongly associated with test flakiness, we noted that job, action, and services are commonly associated with flaky tests. Overall, our results provides initial yet strong evidence that static detection of flaky tests is effective.

Keywords

Regression testing, Test flakiness, Text classification

Discipline

Software Engineering

Research Areas

Software and Cyber-Physical Systems

Publication

Proceedings of the 17th International Conference on Mining Software Repositories, Seoul, 2020, October 5-6

First Page

492

Last Page

502

ISBN

9781450379571

Identifier

10.1145/3379597.3387482

Publisher

ACM

City or Country

Virtual Conference

Additional URL

https://doi.org/10.1145/3379597.3387482

Share

COinS