skip to main content
10.1145/3609437.3609449acmotherconferencesArticle/Chapter ViewAbstractPublication PagesinternetwareConference Proceedingsconference-collections
research-article

Drift: Fine-Grained Prediction of the Co-Evolution of Production and Test Code via Machine Learning

Published: 05 October 2023 Publication History

Abstract

As production code evolves, test code can quickly become outdated. When test code is outdated, it may fail to capture errors in the programs under test and can lead to serious software bugs that result in significant losses for both developers and users. To ensure high software quality, it is crucial to promptly update the test code after making changes to the production code. This practice ensures that the test code and production code evolve together, reducing the likelihood of errors and ensuring the software remains reliable. However, maintaining test code can be challenging and time-consuming. To automate the identification of outdated test code, recent research has proposed Sitar, a machine learning-based method. Despite Sitar’s usefulness, it has major limitations, including its coarse prediction granularity (at class level), reliance on naming conventions to discover test code, and dependence on manually summarized features to construct machine learning models.
In this paper, we address the limitations of Sitar and propose a new machine learning-based approach Drift. Drift predicts outdated test cases at the method level. It leverages method-calling relationships to accurately infer the links between production and test code, and automatically learns features via code analysis. We evaluate Drift using 40 open-source Java projects in both within-project and cross-project scenarios, and find that Drift can achieve satisfactory prediction performances in both scenarios. We also compare Drift with existing methods for outdated test code prediction and find that Drift can significantly outperform them. For example, compared with Sitar, the accuracy of Drift is increased by about 8.5%, the F1-score is increased by about 8.3%, and more importantly, the number of test cases that developers need to check is reduced by about 75%. Therefore, our method, Drift, can predict outdated test cases more accurately at a fine-grained level, and thus better facilitate the co-evolution of production and test code.

References

[1]
Apache. [n. d.]. Maven - introduction to the standard directory layout. http://maven.apache.org/guides/introduction/
[2]
Moritz Beller, Georgios Gousios, and Andy Zaidman. 2017. Oops, my tests broke the build: An explorative analysis of travis ci with github. In 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR). IEEE, 356–367.
[3]
Jason Brownlee. 2020. Data preparation for machine learning: data cleaning, feature selection, and data transforms in Python. Machine Learning Mastery.
[4]
Zebao Gao, Zhenyu Chen, Yunxiao Zou, and Atif M Memon. 2015. SITAR: GUI test script repair. Ieee transactions on software engineering 42, 2 (2015), 170–186.
[5]
Mouna Hammoudi, Gregg Rothermel, and Andrea Stocco. 2016. Waterfall: An incremental approach for repairing record-replay tests of web applications. In Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering. 751–762.
[6]
Jay Kreps. [n. d.]. Kafka. https://rdicosmo.github.io/kafka/
[7]
Stanislav Levin and Amiram Yehudai. 2017. The co-evolution of test maintenance and code maintenance through the lens of fine-grained semantic changes. In 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 35–46.
[8]
Xiangyu Li, Marcelo d’Amorim, and Alessandro Orso. 2019. Intent-preserving test repair. In 2019 12th IEEE Conference on Software Testing, Validation and Verification (ICST). IEEE, 217–227.
[9]
Paul Marinescu, Petr Hosek, and Cristian Cadar. 2014. Covrig: A framework for the analysis of code, test, and coverage evolution in real software. In Proceedings of the 2014 international symposium on software testing and analysis. 93–104.
[10]
Cosmin Marsavina, Daniele Romano, and Andy Zaidman. 2014. Studying fine-grained co-evolution patterns of production and test code. In 2014 IEEE 14th International Working Conference on Source Code Analysis and Manipulation. IEEE, 195–204.
[11]
Mehdi Mirzaaghaei, Fabrizio Pastore, and Mauro Pezzè. 2012. Supporting test suite evolution through test case adaptation. In 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation. IEEE, 231–240.
[12]
Hoan Anh Nguyen, Tung Thanh Nguyen, Tien N Nguyen, and Hung Viet Nguyen. 2017. Interaction-based tracking of program entities for test case evolution. In 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 433–443.
[13]
Terence Parr. [n. d.]. ANTLR4. https://www.antlr.org
[14]
Leandro Sales Pinto, Saurabh Sinha, and Alessandro Orso. 2012. Understanding myths and realities of test-suite evolution. In Proceedings of the ACM SIGSOFT 20th international symposium on the foundations of software engineering. 1–11.
[15]
José Miguel Rojas, Gordon Fraser, and Andrea Arcuri. 2015. Automated unit test generation during software development: A controlled experiment and think-aloud observations. In Proceedings of the 2015 international symposium on software testing and analysis. 338–349.
[16]
Samiha Shimmi and Mona Rahimi. 2022. Leveraging code-test co-evolution patterns for automated test case recommendation. In Proceedings of the 3rd ACM/IEEE International Conference on Automation of Software Test. 65–76.
[17]
Samiha Shimmi and Mona Rahimi. 2022. Patterns of Code-to-Test Co-evolution for Automated Test Suite Maintenance. In 2022 IEEE Conference on Software Testing, Verification and Validation (ICST). IEEE, 116–127.
[18]
Bart Van Rompaey and Serge Demeyer. 2009. Establishing traceability links between unit test cases and units under test. In 2009 13th European Conference on Software Maintenance and Reengineering. IEEE, 209–218.
[19]
Sinan Wang, Ming Wen, Yepang Liu, Ying Wang, and Rongxin Wu. 2021. Understanding and facilitating the co-evolution of production and test code. In 2021 IEEE international conference on software analysis, evolution and reengineering (SANER). IEEE, 272–283.
[20]
Robert White, Jens Krinke, and Raymond Tan. 2020. Establishing Multilevel Test-to-Code Traceability Links. In IEEE/ACM International Conference on Software Engineering.
[21]
Andy Zaidman, Bart Van Rompaey, Serge Demeyer, and Arie Van Deursen. 2008. Mining software repositories to study co-evolution of production & test code. In 2008 1st international conference on software testing, verification, and validation. IEEE, 220–229.
[22]
Andy Zaidman, Bart Van Rompaey, Arie Van Deursen, and Serge Demeyer. 2011. Studying the co-evolution of production and test code in open source and industrial developer test processes through repository mining. Empirical Software Engineering 16, 3 (2011), 325–364.

Index Terms

  1. Drift: Fine-Grained Prediction of the Co-Evolution of Production and Test Code via Machine Learning
        Index terms have been assigned to the content through auto-classification.

        Recommendations

        Comments

        Information & Contributors

        Information

        Published In

        cover image ACM Other conferences
        Internetware '23: Proceedings of the 14th Asia-Pacific Symposium on Internetware
        August 2023
        332 pages
        ISBN:9798400708947
        DOI:10.1145/3609437
        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        Published: 05 October 2023

        Permissions

        Request permissions for this article.

        Check for updates

        Author Tags

        1. Machine Learning
        2. Outdated Test Code
        3. Software Evolution

        Qualifiers

        • Research-article
        • Research
        • Refereed limited

        Conference

        Internetware 2023

        Acceptance Rates

        Overall Acceptance Rate 55 of 111 submissions, 50%

        Contributors

        Other Metrics

        Bibliometrics & Citations

        Bibliometrics

        Article Metrics

        • 0
          Total Citations
        • 73
          Total Downloads
        • Downloads (Last 12 months)45
        • Downloads (Last 6 weeks)3
        Reflects downloads up to 05 Mar 2025

        Other Metrics

        Citations

        View Options

        Login options

        View options

        PDF

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        HTML Format

        View this article in HTML Format.

        HTML Format

        Figures

        Tables

        Media

        Share

        Share

        Share this Publication link

        Share on social media