iOS單元測試和UI測試全面解析(34)
發表于:2017-03-31來源:51CTO作者:朱先忠點擊數:
標簽:單元測試iOS
app.buttons[ Slide ].tap() app.staticTexts[ Getascloseasyoucanto: ].tap() 如果還有其他的語句,則刪除它們。 第一行代碼的作用是復制你在setup()方法中創建的屬性;因為你
app.buttons["Slide"].tap()
app.staticTexts["Get as close as you can to: "].tap()
如果還有其他的語句,則刪除它們。
第一行代碼的作用是復制你在setup()方法中創建的屬性;因為你還不需要點擊任何東西,所以也把這第一行刪除,還要刪除第2行與第3行末尾的“.tap()”。打開["Slide"]鄰近的小菜單并選擇segmentedControls.buttons["Slide"]。
于是,你有了如下的代碼:
-
app.segmentedControls.buttons["Slide"]
-
-
app.staticTexts["Get as close as you can to: "]
進一步修改上述代碼,以便創建測試的given部分:
原文轉自:http://mobile.51cto.com/iphone-535758.htm