讓我給你講講 iOS 自動化測試的那些干貨(8)
發表于:2017-03-10來源:csdn作者:LeoMobileDeveloper點擊數:
標簽:iOS
比如,如下代碼等待VC轉場結束,當query只有一個table的時候,才繼續執行后續的代碼。 [ self expectationForPredicate: [ NSPredicate predicateWithFormat: @ self.count = 1 ]
比如,如下代碼等待VC轉場結束,當query只有一個table的時候,才繼續執行后續的代碼。
[self expectationForPredicate:[NSPredicate predicateWithFormat:@"self.count = 1"]
evaluatedWithObject:app.tables
handler:nil];
[self waitForExpectationsWithTimeout:2.0 handler:nil];
//后續代碼....
Tips: 當你的UI結構比較復雜的時候,比如各種嵌套childViewController,使用XCUIElementQuery的代碼會很長,也不好維護。
另外,UI測試還會在每一步操作的時候截圖,方便對測試報告進行驗證。
查看測試結果
使用基于XCTest的框架,可以在XCode的report navigator中查看測試結果。
原文轉自:http://blog.csdn.net/hello_hwc/article/details/60957515