Mining Android API Usage to Generate Unit Test Cases for Pinpointing Compatibility Issues

Xiaoyu Sun, Xiao Chen, Yanjie Zhao, Pei Liu, John Grundy +1 more
8/29/2022
cs.SE

Official code: SMAT-Lab/JUnitTestGen (4 stars, Java, last commit 2022-08-30).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

41Java, ShellAug 29, 20224 years ago

Similar Papers

Cite this paper

@article{sun2022mining,
  title  = {Mining Android API Usage to Generate Unit Test Cases for Pinpointing Compatibility Issues},
  author = {Xiaoyu Sun and Xiao Chen and Yanjie Zhao and Pei Liu and John Grundy and Li Li},
  year   = {2022},
  eprint = {2208.13417},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2208.13417}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2208.13417.svg)](https://codeofpaper.com/paper/2208.13417)

Discussion