UITests:如何测试标签是否包含更改后的文本?

时间:2015-08-28 14:12:13

标签: swift ios9 xcode-ui-testing

enter image description here

如何点击加上后,我如何撰写UITest以检查我的标签(当前包含文字2)是否已将其值更改为3按钮

1 个答案:

答案 0 :(得分:1)

let app = XCUIApplication()    
let textPredicate = NSPredicate(format: "label = %@", "3")
expectationForPredicate(textPredicate, evaluatedWithObject: app.staticTexts["numberOfItemsLabel"], handler: nil)
app.buttons["increaseNumberOfItemsButton"].tap()