不幸的是,我使用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.
}
Apple文档表示launch()
此呼叫是同步的。返回时,启动应用程序 并准备处理用户事件。启动顺序中的任何失败是 报告为测试失败,并在此时停止测试。
所以它应该可以正常工作,因为模拟器应该先运行,然后再运行测试。