【发布时间】:2018-01-03 09:31:29
【问题描述】:
我正在使用 xcode 8.3.3,swift,我试图让 tearDown 方法只运行一次。
我使用此处提供的解决方案启动应用程序一次: XCTestCase not launching application in setUp class method
在 tearDown 方法中,我想注销应用程序。我只想做一次。
XCTest 文档有一个类 tearDown() 方法,但是当我尝试使用它时 - 它无法再访问应用程序了?: https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods
这是我在 tearDown 方法中得到的所有内容,因此它无法再访问应用程序上的任何元素:
如何在所有测试结束时只运行一次 tearDown 中的代码?
【问题讨论】:
-
您的意思是在所有
XCTestCases 中的所有测试结束时还是在当前XCTestCase中的测试结束时? -
在当前 XCTestCase 中的所有测试之后,感谢您的澄清。
标签: swift xctest xcode-ui-testing ios-ui-automation xctestcase