AutoMate AppBuddy
AppBuddy
是一个 UI 自动化测试的辅助框架,旨在与 AutoMate
一起使用。它可以禁用应用程序中的动画并管理事件、提醒和联系人。
安装
最方便的安装方法是使用带有 Podfile 的 CocoaPods
pod 'AutoMate-AppBuddy'
或使用 Carthage 并在 Cartfile.private
中添加一行
github "PGSSoft/AutoMate-AppBuddy"
Cartfile.private
应该被使用,因为 AutoMate 框架仅将由 UI 测试目标使用而不由被测试的应用程序使用。
注意
AppBuddy
应该与应用程序的目标相关联,而不是与测试目标相关联。
使用方法
完整文档可在https://pgssoft.github.io/AutoMate-AppBuddy/查到。
-
复制现有的应用程序目标。
-
将
AutoMate_AppBuddy
框架导入到应用程序代理中。import AutoMate_AppBuddy
-
在
application(_:didFinishLaunchingWithOptions:)
中设置LaunchEnvironmentManager
。let launchEnvironmentManager = LaunchEnvironmentManager() launchEnvironmentManager.add(handler: defaultEventKitHander, for: .events) launchEnvironmentManager.add(handler: defaultEventKitHander, for: .reminders) launchEnvironmentManager.add(handler: defaultContactsHander, for: .contacts) launchEnvironmentManager.add(handler: defaultIsInUITestHandler, for: .isInUITest) launchEnvironmentManager.add(handler: AnimationHandler(), for: .animation) launchEnvironmentManager.setup()
功能和待办事项
- 禁用UIView动画
- 管理事件、提醒和联系人
- 双向通信
- 模拟网络请求
- 模拟联系人、事件和提醒
- 模拟通知
- 截图
- 清除应用程序数据
- 模拟推送通知
示例应用程序
AutoMate
仓库中的示例应用程序位于AutoMateExample
目录下。应用程序结构简单,但该项目包含了一系列UI测试,展示了库的功能。
开发
完整文档可在https://pgssoft.github.io/AutoMate-AppBuddy/查到。
如果您想处理自定义启动环境,您必须实现Handler
协议,例如:
struct CustomHandler: Handler {
func handle(key: String, value: String) {
if value == "production" {
}
}
}
launchEnvironmentManager.add(handler: CustomHandler(), for: "SERVER")
贡献
欢迎在GitHub上报告错误和发起pull request,链接为https://github.com/PGSSoft/AutoMate-AppBuddy。
许可
该项目符合MIT许可协议,作为开源项目提供。
关于
该项目由软件开发机构PGS Software维护。查看我们的其他开源项目或联系我们以开发您的产品。