[论文解读] Chatting with GPT-3 for Zero-Shot Human-Like Mobile Automated GUI Testing
GPTDroid 将移动 GUI 测试视为问答任务,使用 GPT-3 从 GUI 描述生成测试脚本,然后解码并执行它们,在 Google Play 应用上实现比基线更高的覆盖率和 Bug 检测。
Mobile apps are indispensable for people's daily life, and automated GUI (Graphical User Interface) testing is widely used for app quality assurance. There is a growing interest in using learning-based techniques for automated GUI testing which aims at generating human-like actions and interactions. However, the limitations such as low testing coverage, weak generalization, and heavy reliance on training data, make an urgent need for a more effective approach to generate human-like actions to thoroughly test mobile apps. Inspired by the success of the Large Language Model (LLM), e.g., GPT-3 and ChatGPT, in natural language understanding and question answering, we formulate the mobile GUI testing problem as a Q&A task. We propose GPTDroid, asking LLM to chat with the mobile apps by passing the GUI page information to LLM to elicit testing scripts, and executing them to keep passing the app feedback to LLM, iterating the whole process. Within it, we extract the static context of the GUI page and the dynamic context of the iterative testing process, design prompts for inputting this information to LLM, and develop a neural matching network to decode the LLM's output into actionable steps to execute the app. We evaluate GPTDroid on 86 apps from Google Play, and its activity coverage is 71%, with 32% higher than the best baseline, and can detect 36% more bugs with faster speed than the best baseline. GPTDroid also detects 48 new bugs on the Google Play with 25 of them being confirmed/fixed. We further summarize the capabilities of GPTDroid behind the superior performance, including semantic text input, compound action, long meaningful test trace, and test case prioritization.
研究动机与目标
- 将自动化移动 GUI 测试表述为使用大型语言模型(LLM)的问答问题。
- 通过静态与动态上下文提取,以语义方式向 LLM 描述 GUI 页面。
- 使用神经匹配网络将 LLM 输出解码为可执行的 GUI 操作。
- 在真实世界的 Android 应用上评估 GPTDroid 以评估覆盖率和 Bug 检测。
- 提供关于 LLM 驱动的测试有效性的原因洞察,包括语义输入和测试轨迹质量。
提出的方法
- 从 AndroidManifest 与 view hierarchy 文件提取静态上下文(应用信息、当前 GUI 页面和部件)。
- 通过一个操作记忆器提取动态上下文(迭代测试进度)。
- 设计语言提示模式,并使用静态与动态上下文为 LLM 输入生成提示。
- 使用神经匹配网络将 LLM 报告的步骤映射到具体 GUI 小部件以执行动作。
- 使用启发式驱动的训练数据生成,为神经匹配器提供正/负样例。
- 在 Android-x86 上结合 UIAutomator 和 ADB 实现 GPTDroid,使用 GPT-3 作为 LLM,基于 PyTorch 的组件用于解码和匹配。

实验结果
研究问题
- RQ1GPTDroid 在提升 GUI 测试 activity coverage 方面的有效性如何?
- RQ2GPTDroid 是否能检测到比基线 GUI 测试工具更多的 Bug 且速度更快?
- RQ3神经匹配网络将 LLM 提示转化为有效 GUI 操作的效果如何?
- RQ4在这种设置下,哪些因素能解释 LLM 驱动的 GUI 测试的成功?
主要发现
- GPTDroid 实现 71% 的 activity coverage,比最佳基线高出 32%。
- GPTDroid 以更快的速度检测到比最佳基线多 36% 的 Bug。
- GPTDroid 在 Google Play 上检测到 48 个新的崩溃漏洞,其中 25 个被开发者确认/修复。
- 评估使用了 86 个应用和 129 个漏洞,与 9 个基线进行比较。
- 定性分析指出影响性能的因素:语义文本输入、复合操作、较长的测试轨迹,以及测试用例优先级排序。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。