
import XCTest@testable import MyApp //it doesn't work
因为这个:
class TabbarControllerTests: XCTestCase { overrIDe func setUp() { super.setUp() let defaults = NSUserDefaults.standardUserDefaults() defaults.setobject([],forKey: DBTabbarOrderedindexesKey) //key is undefined,because of lack of my app module defaults.synchronize() continueAfterFailure = false XCUIApplication().launch() } func testIsOrderOfTabsSaved() { XCUIApplication().tabbars.buttons["Catering"].tap() //what next? }} 一旦我点击UITabbarItem我更改了DBAppSettings.mode的值,所以这里我想访问我的DBAppSettings.mode属性来检查它是否真的改变了.
我注意到有一个奇怪的事情,当我构建我的应用程序,并检查是什么构建,没有为我的UITest目标的构建.是不是重要?
解决方法 这是苹果的回应:总结UI tests execute differently from Unit tests – Unit tests run insIDe your application process so they can access your application code. UI tests execute in a separate process,outsIDe your application,so they can simulate how the user interacts with the application. It’s not expected that you will be able to access your app class from a UI test.
以上是内存溢出为你收集整理的ios – 如何将我的App模块导入MyAppUITests文件?全部内容,希望文章能够帮你解决ios – 如何将我的App模块导入MyAppUITests文件?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)