【发布时间】:2017-12-07 19:54:46
【问题描述】:
【问题讨论】:
标签: ios unit-testing xctest uitabbaritem badge
【问题讨论】:
标签: ios unit-testing xctest uitabbaritem badge
您可以将accessibilityIdentifier 值设置为标签栏项目。
tabBarItem.accessibilityIdentifier = "Your_Identifier"
在您的 UITest 案例中,
guard let value = app.buttons["Your_Identifier"].value as? String
else {
XCTFail("badge value not updated")
return
}
XCTAssert(value == "1 item", "badge value not updated")
该值的格式为“number_on_badge item(s)”。因此,在您的情况下,您应该针对“19 个项目”进行测试。
【讨论】: