Skip to main content
QUICK REVIEW

[论文解读] DroidWalker: Generating Reproducible Test Cases via Automatic Exploration of Android Apps

Ziniu Hu, Yun Ma|arXiv (Cornell University)|Oct 24, 2017
Software Testing and Debugging Techniques参考文献 11被引用 4
一句话总结

DroidWalker 是一种动态分析工具,通过构建动态自适应模型,以足够精细的粒度抽象应用状态,从而生成可重现的 Android 应用测试用例。它支持对崩溃和缺陷进行精确的重新执行,适用于回归测试和跨环境验证。

ABSTRACT

Generating test cases through automatic app exploration is very useful for analyzing and testing Android apps. However, test cases generated by current app-exploration tools are not reproducible, i.e. when the generated test case is re-executed, the app cannot reach the same state as the explored one. As a result, app developers are not able to reproduce the failure or crash reported during the exploration, to conduct regression test after fixing the bug, or to execute the same test in different environments. In this paper, we present DroidWalker, a dynamic-analysis tool to generate reproducible test cases for Android apps. The key design of our tool is a dynamic-adaptive model that can abstract the app state in a proper granularity so every state in the model can be reached afterwards. Given an app under test, DroidWalker first explores the app to build the model. Then developers can select the state in the model to be reproduced. Finally, DroidWalker executes all the generated test cases and the app could reach exactly the same state as the explored one. We apply DroidWalker in three real usage scenarios to demonstrate its practical usage. The video of our tool is at https://youtu.be/ndUD8Gxs800.

研究动机与目标

  • 解决现有自动 Android 应用探索工具生成的测试用例缺乏可重现性的关键问题。
  • 使开发人员能够可靠地重现崩溃和 UI 状态,以支持调试和回归测试。
  • 支持对商业 Android 应用的探索,提供可自定义的监控和检测功能。
  • 提供一种机制,通过广度优先搜索(BFS)遍历生成最短路径的测试序列,以定位目标应用状态。
  • 通过确保在不同执行上下文中实现相同的状态重新进入,促进跨环境测试。

提出的方法

  • 在应用探索过程中构建动态自适应模型,以适当的粒度捕获应用状态,以容忍轻微的 UI 变化。
  • 使用广度优先搜索(BFS)生成能够以最少步骤到达目标状态的事件序列。
  • 以语义感知方式记录事件轨迹,确保在 UI 布局变化时仍能正确识别控件。
  • 通过插件类集成可自定义的检测功能,用于在探索过程中监控日志、异常或特定行为。
  • 使用基于模型的状态引用存储并重放测试用例,确保重执行时可到达相同的应用状态。
  • 通过依赖模型定义的状态标识符而非绝对屏幕坐标,支持在不同设备或模拟器上重执行测试用例。

实验结果

研究问题

  • RQ1能否构建一个动态自适应模型,以实现在 Android 应用探索中可重现的测试用例生成?
  • RQ2如何生成事件序列,以在存在轻微 UI 变化的情况下仍能可靠地到达特定应用状态?
  • RQ3与现有基于模型的工具相比,DroidWalker 在实现更高代码覆盖率以及探索商业 Android 应用方面能达到何种程度?
  • RQ4能否有效将自定义监控功能集成到探索流水线中,以检测特定缺陷或异常?
  • RQ5DroidWalker 在跨不同执行环境重现崩溃以及支持回归测试方面的有效性如何?

主要发现

  • DroidWalker 通过采用动态自适应粒度建模应用状态,成功生成可重现的测试用例,确保在不同环境中的一致性重执行。
  • 该工具在代码覆盖率方面优于现有基于模型的探索工具,这一点在探索复杂商业应用(如 Fitbit)时得到验证。
  • 在探索 Fitbit 的过程中,DroidWalker 检测到两个关键异常:java.lang.UnsupportedOperationException 和 java.io.FileNotFoundException,且均可在重执行时重现。
  • 通过导航至第 6 个 UI 状态,该工具成功精确重现了 java.io.FileNotFoundException,确认重执行时发生了相同的崩溃。
  • 自定义检测功能(如 ExceptionCollector 类)已成功实现并用于监控 logcat 输出,实现在探索过程中的自动化缺陷检测。
  • DroidWalker 基于 BFS 的测试用例生成方法,成功生成到达目标状态的最短路径序列,确保了高效且确定性的状态重进入。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。