一句话:提出 JUnitTestGen,挖掘 Android API 使用并经过程间反向数据流分析生成单元测试,以定位兼容性问题。
Android 官方框架仅为不到 30% 的 API 提供测试用例,导致许多兼容性问题难以在开发期发现,应用可能在特定设备上崩溃。已有工作主要检测签名级兼容性问题(某 API 在特定版本中不存在),忽略了语义代码变更等其他重要类型。为此,作者提出 JUnitTestGen:在真实 Android 应用中定位 API 使用,并通过过程间反向数据流分析,生成最小可执行代码片段作为单元测试用例。在数千个真实 Android 应用上的实验表明,该工具能为 Android API 有效生成合法单元测试用例;这些用例有助于定位兼容性问题,包括涉及语义代码变更的问题。
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.
@inproceedings{paperbot7221,
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},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3561151}
}