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

Research output: Chapter in Book/Report/Conference proceedingConference PaperResearchpeer-review

8 Citations (Scopus)

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.

Original languageEnglish
Title of host publicationProceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering
EditorsJulia Rubin, Thomas Kirste, Shahar Maoz
Place of PublicationNew York NY USA
PublisherAssociation for Computing Machinery (ACM)
Number of pages13
ISBN (Electronic)9781450394758
DOIs
Publication statusPublished - 2022
EventInternational Conference on Automated Software Engineering 2022 - Rochester, United States of America
Duration: 10 Oct 202214 Oct 2022
Conference number: 37th
https://dl.acm.org/doi/proceedings/10.1145/3551349 (Proceedings)
https://ase-conferences.org/ (Website)

Conference

ConferenceInternational Conference on Automated Software Engineering 2022
Abbreviated titleASE 2022
Country/TerritoryUnited States of America
CityRochester
Period10/10/2214/10/22
Internet address

Cite this