- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
这是我的简单测试用例:
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 目标构建。重要吗?
最佳答案
这是 Apple 的回应:
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 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31769120/
我有一个 Obj-C 项目,正在向其中添加 UI 测试目标。因为我使用的是网络扩展,所以无法使用自动代码签名。当我创建 UI 测试目标时,我选择 Swift 作为语言。 (虽然我也尝试过 Obj-C。
这是我的简单测试用例: import XCTest @testable import MyApp //it doesn't work 因为这个: class TabBarControllerTests
我是一名优秀的程序员,十分优秀!