2017-03-20 30 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测试。