我如何在 XCODE 8 , Swift 3 中使用 UIAutomation
How can i use UIAutomation in XCODE 8 , Swift 3
导入 XCTest
class 单元测试类: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 classes。现在,我想通过 UIAutomation 在 Xcode 8,swift 3 中测试每个 class。经过大量搜索,我没有在 Xcode 中得到任何有用的教程或工具或 swift 的最新版本。我的应用程序的第一个屏幕是登录屏幕。谁能帮我找出有用的解决方案
我相信 UI自动化在 Xcode 8 中被弃用。但是您可以通过简单地执行以下操作在 Xcode 8 中设置 UI 测试:
- 向您的项目添加 iOS UI 测试包目标。
- 在作为该目标的一部分创建的新测试文件下创建测试方法。
- 单击方法内的大括号内。
- 单击源代码编辑器下方显示的 "record" 图标开始记录您在模拟器中的 UI 操作。
观看此 WWDC Video 以了解有关 Xcode 中 UI 测试的更多信息。
导入 XCTest
class 单元测试类: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 classes。现在,我想通过 UIAutomation 在 Xcode 8,swift 3 中测试每个 class。经过大量搜索,我没有在 Xcode 中得到任何有用的教程或工具或 swift 的最新版本。我的应用程序的第一个屏幕是登录屏幕。谁能帮我找出有用的解决方案
我相信 UI自动化在 Xcode 8 中被弃用。但是您可以通过简单地执行以下操作在 Xcode 8 中设置 UI 测试:
- 向您的项目添加 iOS UI 测试包目标。
- 在作为该目标的一部分创建的新测试文件下创建测试方法。
- 单击方法内的大括号内。
- 单击源代码编辑器下方显示的 "record" 图标开始记录您在模拟器中的 UI 操作。
观看此 WWDC Video 以了解有关 Xcode 中 UI 测试的更多信息。