Fastbot_iOS:基于机器学习与强化学习的iOS GUI稳定性测试工具

About Fastbot(2.0) is a model-based testing tool for modeling GUI transitions to discover app stability problems

分支4Tags0
文件最后提交记录最后更新时间
4 年前
3 年前
4 年前
3 年前

简介

Fastbot 是一款基于模型的测试工具,通过对 GUI 界面跳转进行建模来发现应用的稳定性问题。它融合了机器学习与强化学习技术,以更智能的方式辅助问题发现。

相关项目:Fastbot_Android

***更多详细信息请参见 Fastbot 架构

2022年1月更新

  • 更新 Fastbot 修订版许可协议
  • 发布 AnyTrace,即 Fastbot 测试管理助手:支持一键启动 Fastbot 测试、崩溃分析等功能(AnyTrace 用户手册

准备测试环境

  • cd Fastbot-iOS && pod install --repo-update
    • 打开 Fastbot-iOS.xcworkspace,设置 FastbotRunner签名与功能 以及 Bundle ID
    • 通过 USB 连接设备并信任该设备;如果使用模拟器,请启动模拟器
    • 开启 FastbotRunner 的网络权限(模拟器无需此操作),以设备 00008030-001054A80C82802E 为例:
BUNDLEID=com.apple.Pages duration=240 throttle=300 xcodebuild test  -workspace Fastbot-iOS.xcworkspace -scheme FastbotRunner  -configuration Release  -destination 'platform=iOS,id=00008030-001804563E44802E' -only-testing:FastbotRunner/FastbotRunner/testPingNetwork
    • 在设备上点击 FastbotRunner 后,设备屏幕会黑屏约一分钟。黑屏期间,用户需按下设备的 Home 键返回到主屏幕。耐心等待,直到网络设置对话框弹出。用户应允许该弹出请求以继续操作。
    • 如果控制台日志中出现 "ping network success",则表示网络权限获取成功

运行测试

  • 确保您的应用程序可以在设备上运行(已安装并信任)
key note sample
BUNDLEID 测试应用的 Bundle ID com.apple.Pages
duration 测试时长,单位为分钟 300
launchenv 测试应用的启动参数,可为空或使用冒号分隔的键值对 isAutoTestUI=1:channel=AutoTest
throttle 操作间隔时间,单位为毫秒 300
  • 在设备 00008030-001054A80C82802E 上运行测试的示例。如果 IDE 方案环境变量已更改,命令行环境变量将失效:
BUNDLEID=com.apple.Pages duration=240 throttle=300 xcodebuild test  -workspace Fastbot-iOS.xcworkspace -scheme FastbotRunner  -configuration Release  -destination 'platform=iOS,id=00008030-001804563E44802E' -only-testing:FastbotRunner/FastbotRunner/testFastbot

更多详情请参见 中文手册


高级扩展

Stub 模式:目标动态库 fastbot_stub。Stub 模式需要将 fastbot_stub 注入到测试应用中。该库通过解析被测应用为 Fastbot 捕获 GUI 结构。用户可以构建更多自定义功能(例如钩子回调、裁剪视图),以实现阻止特定视图被点击、自定义 ViewController 等附加能力。

我们非常感谢社区的任何贡献!!!

使用方法: 将 fastbot_stub 注入应用后,您需要:

  • 取消注释 FastbotRunner.m 中的代码块 [fastbot_native addUIInterruptionMonitor: ...];
  • 通过编辑 Scheme 环境变量 运行 stub 模式(9797 可更改为其他端口号):
key sample
launchenv stubPort=9797
dataport 9797

数据分析

为了优化和改进 Fastbot-iOS,FastbotRunner 会收集使用数据并上传至 Google Analytics。FastbotRunner 会收集测试应用 Bundle ID 的 md5 哈希值,此信息用于我们统计使用量。如果用户希望,可以通过跳过“开启 FastbotRunner 网络权限”步骤,或在系统设置中将 FastbotRunner 的“无线数据”设为关闭,来选择禁用数据分析功能。


支持

  • 建议在 GitHub 上进行公开技术讨论。

  • 常见问题解答:

    :执行 pod install --repo-update 时出错
    :先安装指定版本的 pod:sudo gem install cocoapods -v=1.8.1

    :出现错误:Assert Fail Timed out while evaluating UI query(评估 UI 查询时超时)
    :重启测试、重新插拔 USB、更换 USB 线或重启 iPhone

    :使用模拟器时出错
    :在 scheme 设置中切换到 Debug 模式

    :出现未知安装错误:com.apple.dt.MobileDeviceErrorDomain
    :检查签名证书、重新插拔 USB、更换 USB 线或重启 iPhone


许可协议

版权所有©2021 字节跳动

根据 Fastbot 修订版许可协议 进行许可

Fastbot-iOS 的部分功能基于以下项目或从中衍生:

相关出版物

如果您在研究中使用了我们的成果,请引用以下文献:

  1. Lv, Zhengwei, Chao Peng, Zhao Zhang, Ting Su, Kai Liu, Ping Yang (2022). “Fastbot2: Reusable Automated Model-based GUI Testing for Android Enhanced by Reinforcement Learning”. In proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering (ASE 2022). ACM, To appear. [pdf]
@inproceedings{fastbot2,
  title={Fastbot2: Reusable Automated Model-based GUI Testing for Android Enhanced by Reinforcement Learning},
  author={Lv, Zhengwei and Peng, Chao and Zhang, Zhao and Su, Ting and Liu, Kai and Yang, Ping},
  booktitle={Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering (ASE 2022)},
  year={2022}
}
  1. 彭超、张赵、吕正伟、杨平(2022)。“MUBot:像人类一样测试大规模商业 Android 应用”。发表于第 38 届国际软件维护与演化会议(ICSME 2022)论文集。IEEE,待发表。[pdf]
@inproceedings{mubot,
  title={MUBot: Learning to Test Large-Scale Commercial Android Apps like a Human},
  author={Peng, Chao and Zhang, Zhao and Lv, Zhengwei and Yang, Ping},
  booktitle={Proceedings of the 38th International Conference on Software Maintenance and Evolution (ICSME 2022)},
  year={2022}
}
  1. Cai, Tianqin, Zhao Zhang, and Ping Yang. “Fastbot: A Multi-Agent Model-Based Test Generation System”(Fastbot:一种基于多智能体模型的测试生成系统)。In Proceedings of the IEEE/ACM 1st International Conference on Automation of Software Test(见《IEEE/ACM第一届软件测试自动化国际会议论文集》)。2020. [pdf]
@inproceedings{fastbot,
  title={Fastbot: A Multi-Agent Model-Based Test Generation System},
  author={Cai, Tianqin and Zhang, Zhao and Yang, Ping},
  booktitle={Proceedings of the IEEE/ACM 1st International Conference on Automation of Software Test},
  pages={93--96},
  year={2020}
}

项目介绍

关于Fastbot(2.0):这是一款基于模型的测试工具,用于模拟图形用户界面(GUI)的转换,以发现应用程序的稳定性问题。【此简介由AI生成】

定制我的领域