简体   繁体   English

如何暂停XCUITest进行手动模拟器操作?

[英]How to pause XCUITest for manual Simulator manipulation?

I'm trying to automate parts of my UI testing using XCUITest. 我正在尝试使用XCUITest自动化部分UI测试。 I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. 我不想测试自动完成部分测试,然后等我手动做一些事情。 Is there a good way to do this? 有没有办法做到这一点?

Right now I'm just doing this: 现在我只是这样做:

class QDBUITestHost: XCTestCase {

  override func setUp() {
    continueAfterFailure = false
    XCUIApplication().launch()
  }

  override func tearDown() {}

  func testHosting() {
    let app = XCUIApplication()
    app.buttons["Select Group"].tap()
    app.sheets.buttons["com-mist-qdb-1"].tap()
    app.buttons["Host"].tap()
    sleep(600) // This is an ugly hack
  }

}

So, is there a better way to do this, rather than to just sleep(600) ? 那么,有没有更好的方法来做到这一点,而不是只是sleep(600)

There is a xctwaiter framework. 有一个xctwaiter框架。

You can use expectations to wait the results. 您可以使用期望等待结果。 They are very flexible. 他们非常灵活。

let result = XCTWaiter().wait(for:[expectation], timeout: 10)

How to use an expectation you can see in the documentation. 如何使用文档中可以看到的期望。 An example . 一个例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM