Mining Android API Usage to Generate Unit Test Cases for Pinpointing Compatibility Issues
Xiaoyu Sun, Xiao Chen, Yanjie Zhao, Pei Liu, John Grundy, Li Li
Abstract
Despite being one of the largest and most popular projects, the official Android framework has only provided test cases for less than 30% of its APIs. Such a poor test case coverage rate has led to many compatibility issues that can cause apps to crash at runtime on specific Android devices, resulting in poor user experiences for both apps and the Android ecosystem. To mitigate this impact, various approaches have been proposed to automatically detect such compatibility issues. Unfortunately, these approaches have only focused on detecting signature-induced compatibility issues (i.e., a certain API does not exist in certain Android versions), leaving other equally important types of compatibility issues unresolved. In this work, we propose a novel prototype tool, JUnitTestGen, to fill this gap by mining existing Android API usage to generate unit test cases. After locating Android API usage in given real-world Android apps, JUnitTestGen performs inter-procedural backward data-flow analysis to generate a minimal executable code snippet (i.e., test case). Experimental results on thousands of real-world Android apps show that JUnitTestGen is effective in generating valid unit test cases for Android APIs. We show that these generated test cases are indeed helpful for pinpointing compatibility issues, including ones involving semantic code changes.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 0fb8ddb4-c2e1-41d9-9334-ec600470ca6dCited by top-tier papers5
- Compatibility Issues in Deep Learning Systems: Problems and OpportunitiesJun Wang, Guanping Xiao, Shuai Zhang, Huashan Lei et al.FSE 2023 · 13 citations
- ReuNify: A Step Towards Whole Program Analysis for React Native Android AppsYonghui Liu, Xiao Chen, Pei Liu, John Grundy et al.ASE 2023 · 7 citations
- Navigating the Labyrinth: Path-Sensitive Unit Test Generation with Large Language ModelsDianshu Liao, Xin Yin, Shidong Pan, Chao Ni et al.ASE 2025 · 2 citations
- Why the Proof Fails in Different Versions of Theorem Provers: An Empirical Study of Compatibility Issues in IsabelleXiaokun Luan, David Sanán, Zhe Hou, Qiyuan Xu et al.FSE 2025 · 1 citation
- Deployability-Centric Infrastructure-as-Code Generation: Fail, Learn, Refine, and Succeed through LLM-Empowered DevOps SimulationTianyi Zhang, Shidong Pan, Zejun Zhang, Zhenchang Xing et al.FSE 2026 · 1 citation
Builds on4
- API-Misuse Detection Driven by Fine-Grained API-Constraint Knowledge GraphXiaoxue Ren, Xinyuan Ye, Zhenchang Xing, Xin Xia et al.ASE 2020 · 62 citations
- JuCify: A Step Towards Android Code Unification for Enhanced Static AnalysisJordan Samhi, Jun Gao, Nadia Daoudi, Pierre Graux et al.ICSE 2022 · 43 citations
- Flaky test detection in Android via event order explorationZhen Dong, Abhishek Tiwari, Xiao Liang Yu, Abhik RoychoudhuryFSE 2021 · 25 citations
- Automatically detecting API-induced compatibility issues in Android apps: a comparative analysis (replicability study)Pei Liu, Yanjie Zhao, Haipeng Cai, Mattia Fazzini et al.ISSTA 2022 · 21 citations
Related papers
- Compatibility Issue Detection for Android Apps Based on Path-Sensitive Semantic AnalysisSen Yang, Sen Chen, Lingling Fan, Sihan Xu et al.ICSE 2023 · 12 citations
- How Android developers handle evolution-induced API compatibility issues: a large-scale studyHao Xia, Yuan Zhang, Yingtian Zhou, Xiaoting Chen et al.ICSE 2020 · 38 citations
- Characterizing and Detecting Configuration Compatibility Issues in Android AppsHuaxun Huang, Ming Wen, Lili Wei, Yepang Liu et al.ASE 2021 · 15 citations
- ComboDroid: generating high-quality test inputs for Android apps via use case combinationsJue Wang, Yanyan Jiang, Chang Xu, Chun Cao et al.ICSE 2020 · 61 citations
- ConfFix: Repairing Configuration Compatibility Issues in Android AppsHuaxun Huang, Chi Xu, Ming Wen, Yepang Liu et al.ISSTA 2023 · 10 citations
