【问题标题】:How can i use UIAutomation in XCODE 8 , Swift 3我如何在 XCODE 8、Swift 3 中使用 UIAutomation
【发布时间】:2017-03-20 09:55:27
【问题描述】:

导入 XCTest

类 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 类。现在,我想在 Xcode 8、swift 3 中通过 UIAutomation 测试每个类。经过大量搜索,我在 Xcode 或 swift 的最新版本中没有得到任何有用的教程或工具。我的应用程序的第一个屏幕是登录屏幕。谁能帮我找出有用的解决方案

【问题讨论】:

    标签: swift unit-testing xcode8 ui-automation


    【解决方案1】:

    我相信 UIAutomation 在 Xcode 8 中已被弃用。但您可以通过简单地执行以下操作在 Xcode 8 中设置 UI 测试:

    1. 将 iOS UI 测试包目标添加到您的项目中。
    2. 在作为该目标的一部分创建的新测试文件下创建一个测试方法。
    3. 在方法内的花括号内单击。
    4. 点击源编辑器下方显示的“记录”图标,开始在模拟器中记录您的 UI 操作。

    观看此WWDC Video,了解有关 Xcode 中的 UI 测试的更多信息。

    【讨论】:

      猜你喜欢
      • 2016-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-01
      • 2017-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多