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.
翻译:尽管是最大和最受欢迎的项目之一,但官方安道尔框架仅为不到30%的API提供了测试案例。这样的低测试案例覆盖率导致许多兼容性问题,导致应用程序在运行时在特定安道装置上自动崩溃,导致应用程序在特定安道尔特装置和安道尔特生态系统中的用户经验差。为了减轻这一影响,提出了各种办法自动检测这种兼容性问题。不幸的是,这些办法仅侧重于检测签名引发的兼容性问题(即某些安达罗尔版本中不存在某种API),而其他同样重要的兼容性问题没有得到解决。在这项工作中,我们提出了一个新型的原型工具,即JUnioteTeggen,通过挖掘现有的安达·API,填补这一空白,以生成单位测试案例。在定位给定的应用程序和机器人应用程序中使用安达洛德·API之后,JUnitTeggle Gen进行了跨程序向后的数据流分析,以产生一个最小的可执行代码(即测试案例),使数千个实体安达罗尔特应用软件软件的实验结果,包括JAnisterGeorget 测试案例。