一句话:提出页面迁移图模型并静态构建,实现 HarmonyOS 应用的模型驱动 GUI 测试工具,显著提升覆盖率。
HarmonyOS 生态快速扩张,如何自动测试其应用以保证质量成为重要问题。现有基于模型的测试在 Android GUI 上有效,但尚需适配 HarmonyOS。本文提出页面迁移图模型,用有向图刻画 HarmonyOS 应用各 UI 页面之间的迁移;进而设计静态分析方法,从应用源码中自动构建页面迁移图。基于该模型实现 GUI 测试工具,对应用进行系统化探索。作者用 GitHub 和 Gitee 上 10 个流行开源 HarmonyOS 应用评估,结果表明提取的模型精度很高,且在同一时间预算下,基于模型的测试相比随机基线显著提升测试覆盖率。工具已开源。
HarmonyOS is a new all-scenario operating system. As its software ecosystem rapidly expands, how to conduct automated testing of HarmonyOS apps to ensure app quality has become a crucial task. Model-based testing has been shown to be an effective method for automatic Android app GUI testing. Inspired by previous work, we in this work explore how to perform model-based testing for HarmonyOS apps. To characterize app behaviors, we first propose the page transition graph model, which is a directed graph describing transitions between various UI pages in a HarmonyOS app. We then devise a static analysis method to build page transition graphs from the source code of HarmonyOS apps. Leveraging the model, we implement a testing tool which can effectively perform systematic GUI exploration in HarmonyOS apps. We have evaluated our tool using 10 popular open-source HarmonyOS apps from GitHub and Gitee. Experimental results show that the extracted models are highly precise. Moreover, within the same time budget, model-based testing significantly improves the test coverage of HarmonyOS apps over a random baseline method. Our tool is open-sourced at https://github.com/sqlab-sustech/HarmonyOS-App-Test and a video demo is at https://youtu.be/dgZWkHiBYbA.