ios - Swift UITest - 将使用两者之一。哪个是未定义的

标签 ios swift testing xcode-ui-testing uitest

我正在尝试进行一些 UITest,但遇到了烦人的问题。

当我尝试获取 tableView/tableCell 时,我在日志中收到此文本,但我的测试失败了。

objc[18223]: Class VCWeakObjectHolder is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/Frameworks/ViceroyTrace.framework/ViceroyTrace (0x131ad04d0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AVConference.framework/AVConference (0x131797e38). One of the two will be used. Which one is undefined.

这是我用来进行测试的代码:

let app = XCUIApplication()
let table = app.tables

let cell = table.cells.element(matching: .cell, identifier: "cell_settings_1")
_ = cell.waitForExistence(timeout: 10.0)
cell.tap()

XCTAssert(app.otherElements["view_about"].exists)

我的 tableViewCell 有这个字符串作为标识符,这不是问题。

当我尝试记录测试时,我收到此错误:

Error

有人可以帮助我吗?

最佳答案

经过这么多次我发现了我的错误。

问题是我在 View 的父级中放置了一个可访问性标识符......然后,里面的元素将永远无法正常工作。

这是一张图片:

enter image description here

因此,在图像情况下,“view_about”中的任何内容都不会被测试(甚至记录器)检测到。

关于ios - Swift UITest - 将使用两者之一。哪个是未定义的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50824352/

相关文章:

ios - WKWebView在html中打开src

ios - 如何将 `Observable` 转换为 `ControlEvent`

ios - Swift iOS 中的屏幕截图?

testing - 我想使用 JMETER 和 Fix users and Time 执行性能测试

ios - 搜索核心数据中的关系数量 - Swift

ios - iOS 上的 Safari 是否支持 DNS 预取指令?

ios - 如何在 swift 5 中的谷歌地图右上角添加固定 subview

node.js - 在 NodeJS 中测试数据库相关代码

testing - 加载测试命名空间

ios - 如何将图像拉伸(stretch)成自定义形状(swift3)