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

ios – UITest的简单XCTest一直都在失败?

发布时间:2020-12-14 19:37:59 所属栏目:百科 来源:网络整理
导读:我从File开始一个新项目 – 新 – 项目 我向ViewController添加了一个按钮. 我打开默认由xcode创建的UITest文件夹.运行测试代码. 它失败: 2016-03-16 12:57:09.191 XCTRunner[3511:150419] Continuing to run tests in the background with task ID 1 t = 1
我从File开始一个新项目 – >新 – >项目

我向ViewController添加了一个按钮.

我打开默认由xcode创建的UITest文件夹.运行测试代码.

它失败:

2016-03-16 12:57:09.191 XCTRunner[3511:150419] Continuing to run tests in the background with task ID 1
    t =    10.18s         Assertion Failure: UI Testing Failure - Failed to background test runner.
/Users/Bernard/Desktop/ExampleTestApplication/ExampleTestApplicationUITests/test2.m:27: error: -[test2 testExample] : UI Testing Failure - Failed to background test runner.
2016-03-16 12:57:12.789 XCTRunner[3511:150419] *** Terminating app due to uncaught exception '_XCTestCaseInterruptionException',reason: 'Interrupting test'

现在我添加一个断点如下:

enter image description here

现在测试成功了!任何人都可以解释原因吗?

解决方法

我也遇到了同样的问题,没有一个可用的解决方案适合我.问题不是让应用程序附加到模拟器本身. 我检查了日志,发现在找到元素时我在代码中犯了一个错误.对于谓词而不是BEGINSWITH,我写了STARTSWITH,这是为了阻止应用程序附加. 因此,请检查测试报告中的日志以解决问题.

(编辑:李大同)

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

    推荐文章
      热点阅读