2017-03-20 31 views
0

進口XCTest我怎樣才能在Xcode 8使用UIAutomation,斯威夫特3

類UnitTestClass:XCTestCase {

override func setUp() { 
    super.setUp() 
    // Put setup code here. This method is called before the invocation of each test method in the class. 
} 

override func tearDown() { 
    // Put teardown code here. This method is called after the invocation of each test method in the class. 
    super.tearDown() 
} 

func testExample() { 

} 

我在我的應用程序多的UIViewController類。現在,我想通過UIAutomation在Xcode 8,Swift 3中測試每個類。搜索了很多後,我沒有在Xcode或swift的最新版本中獲得任何有用的教程或工具。我的應用程序的第一個屏幕是登錄屏幕。誰能幫我找到時的有用的解決方案

回答

1

相信UIAutomation在Xcode中8棄用但是你可以簡單地做以下設置在Xcode 8 UI測試:

  1. 添加iOS的UI測試捆綁目標到您的項目。
  2. 在作爲該目標的一部分創建的新測試文件下創建測試方法。
  3. 在方法內的花括號內單擊。
  4. 單擊源代碼編輯器下方顯示的「記錄」圖標開始在模擬器中記錄您的UI操作。

看着這個WWDC Video瞭解更多關於Xcode中的UI測試。