How to speed up UI test cases in Xcode?

前端 未结 7 1658
自闭症患者
自闭症患者 2020-12-13 14:29

Since Xcode 7 we have a nice API for UI testing. Mostly I\'m satisfied with it. The only concern is related to the speed.

In the beginning an ordina

7条回答
  •  轮回少年
    2020-12-13 15:28

    Following @Mark answer, the Swift 3 version:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
        if ProcessInfo.processInfo.arguments.contains("UITests") {
            UIApplication.shared.keyWindow?.layer.speed = 200
        }
    }
    

    On you ui test file:

    override func setUp() {
        super.setUp()
    
        // Put setup code here. This method is called before the invocation of each test method in the class.
    
        let app = XCUIApplication()
        app.launchArguments = ["UITests"]
        app.launch()
    

提交回复
热议问题