我使用 Bitrise 作为 CI 解决方案,不幸的是,在启动 UITests 时,日志告诉我。
尝试在 Bitrise iOS 版本中启动失败 已过期令牌:此令牌仍不存在任何操作。
单元测试工作正常。不知道为什么会这样。模拟器似乎可以正常启动。
当然发射被称为是里面setUp()
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test.
// Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests it’s important to set the initial state - such as interface orientation -
// required for your tests before they run. The setUp method is a good place to do this.
}
苹果文档说launch()
这个调用是同步的。当它返回时,应用程序启动并准备好处理用户事件。启动序列中的任何失败都会报告为测试失败并在此时停止测试。
所以它应该可以正常工作,因为模拟器应该在运行测试之前首先启动。