【发布时间】:2016-11-04 05:21:14
【问题描述】:
即使只是运行默认的 testExample 类(没有代码),我的 XCode UI 测试也无法使用机器人运行。相反,我收到一个错误:
测试失败:测试目标 UIBotTest 遇到错误(早期 意外退出,操作从未完成引导 - 没有重新启动 将尝试) ** 测试失败 **
在机器人之外,我的测试正在运行并通过,没有出现此类故障。 我尝试实施的一个解决方案是利用系统警报处理程序在应用程序首次启动时处理通知权限警报,如下所示:
XCUIApplication *app = [[XCUIApplication alloc]init];
[self addUIInterruptionMonitorWithDescription:@"Notification Handler" handler:^BOOL(XCUIElement * _Nonnull interruptingElement) {
if ([interruptingElement.buttons[@"OK"] exists])
{
[interruptingElement.buttons[@"OK"] tap];
[app tap];
return true;
}
return false;
}];
我尝试在我的 setUp 和 testExample 函数中实现这一点,它再次在模拟器和物理设备上运行良好,但在机器人上失败并出现同样的错误。
有什么想法吗?
【问题讨论】:
标签: ios xcode xcode-ui-testing