加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – XCTests无法在模拟器间歇性启动应用程序

发布时间:2020-12-15 01:54:24 所属栏目:百科 来源:网络整理
导读:有没有经验和固定: XCtests间歇性地在UI测试模拟器(XCUI)中启动应用程序。 我正在运行fastlane,不同的测试似乎失败每次测试运行。 OSX:10.12.3 iOS模拟器:10.0 XCode 8.2.1 Fastlane 2.11.0 尝试通过在我的测试中在设置和启动之间添加3秒钟的睡眠来修复
有没有经验和固定:

XCtests间歇性地在UI测试模拟器(XCUI)中启动应用程序。
我正在运行fastlane,不同的测试似乎失败每次测试运行。

OSX:10.12.3
iOS模拟器:10.0
XCode 8.2.1
Fastlane 2.11.0

尝试通过在我的测试中在设置和启动之间添加3秒钟的睡眠来修复它,但它仍然出现,也许不是经常但仍然…

UI Testing Failure – Failure attempting to launch
:
Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 “The request
to open “no.something.bb.debug” failed.”
UserInfo={NSLocalizedDescription=The request to open
“no.something.bb.debug” failed.,NSLocalizedFailureReason=The request
was denied by service delegate (SBMainWorkspace) for reason: Busy
(“Application “no.something.bb.debug” is installing or uninstalling,
and cannot be launched”).,BSErrorCodeDescription=RequestDenied,
NSUnderlyingError=0x6080002598f0 {Error
Domain=FBSOpenApplicationErrorDomain Code=6 “Application
“no.something.bb.debug” is installing or uninstalling,and cannot be
launched.” UserInfo={BSErrorCodeDescription=Busy,
NSLocalizedFailureReason=Application “no.something.bb.debug” is
installing or uninstalling,and cannot be launched.}}}

解决方法

我遇到同样的问题。我发现有一个辐射器为此开放。在评论中,我发现一个提示,我实现了一个功能,重试。

arguments数组是一个枚举值的数组,其基类型是String。我使用它的应用程序参数。

不幸的是,这还没有充分证明。在我的情况下,失败的数量大幅下降,但没有消失。

var app: XCUIApplication = XCUIApplication()
public func tryLaunch<T>(_ arguments: [T],_ counter: Int = 10) where T: RawRepresentable {
    sleep(3)
    XCUIApplication().terminate()
    sleep(3)

    app = XCUIApplication()
    app.launchArguments = arguments.map { $0.rawValue as! String }
    app.launch()
    sleep(3)
    if !app.exists && counter > 0 {
        tryLaunch(arguments,counter - 1)
    }
}

上述功能包含在https://github.com/evermeer/UITestHelper中

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读