UI测试运行时的控制台:
Test Case '-[FizzBuzzUITests.VIEwControllerUITests testTapNumberbuttonIncrementsscore]' started. t = 0.00s Start Test at 2017-04-10 10:44:25.544 t = 0.00s Set Up t = 0.01s Tap "numberbutton" button t = 0.01s Wait for app to IDle t = 0.07s Find the "numberbutton" button t = 0.08s Wait for app to IDle t = 1.13s Find the "numberbutton" button (retry 1) t = 1.25s Wait for app to IDle t = 2.29s Find the "numberbutton" button (retry 2) t = 2.41s Wait for app to IDle t = 2.48s Assertion Failure: VIEwControllerUITests.swift:25: Application is not running,unable to get Accessibility data. DID you call -launch?
启动MyAppUITests时的模拟器系统日志:(删除了comp名称和时间戳以便于阅读)
assertiond[34190]: submitted job with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]SpringBoard[34185]: [com.apple.test.MyAppUITests-Runner] bootstrap complete with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]XCTRunner[34865]: assertion Failed: 16E195 14E269: libxpc.dylib + 64131 [624BAF4F-2E03-34F8-ACBA-970B04637786]: 0x7dXCTRunner[34865]: Running tests...XCTRunner[34865]: No configuration specifIEd in environment,checking for the most recent test configuration in TMPDIR (/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272/tmp/)XCTRunner[34865]: XCTRunner Arguments: ( "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Bundle/Application/B2EA026D-FB60-4164-9C69-5EDDEC53427F/MyAppUITests-Runner.app/XCTRunner")XCTRunner[34865]: XCTRunner Environment: { "CFFIXED_USER_HOME" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272"; CLASSIC = 1; "CUPS_SERVER" = "/private/tmp/com.apple.launchd.JL1cDBUGQn/Listeners"; "DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/System/library/Frameworks"; "DYLD_FALLBACK_liBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/usr/lib"; "DYLD_ROOT_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk"; "DYLD_SHARED_REGION" = avoID; HOME = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272"; "IOS_SIMulATOR_SYSLOG_SOCKET" = "/private/tmp/com.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim/syslogsock"; "IPHONE_SHARED_RESOURCES_DIRECTORY" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data"; "IPHONE_SIMulATOR_CLASS" = D10; "IPHONE_SIMulATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk"; "IPHONE_TVOUT_EXTENDED_PROPERTIES" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/library/Application Support/Simulator/extended_display.pList"; PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk/usr/local/bin"; "SIMulATOR_CAPABIliTIES" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/library/CoreSimulator/Profiles/DeviceTypes/iPhone 7.simdevicetype/Contents/Resources/capabilitIEs.pList"; "SIMulATOR_DEVICE_name" = "iPhone 7"; "SIMulATOR_EXTENDED_disPLAY_PROPERTIES" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/library/Application Support/Simulator/extended_display.pList"; "SIMulATOR_HID_SYstem_MANAGER" = "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/Resources/Platforms/iphoneos/SimulatorHID.framework"; "SIMulATOR_HOST_HOME" = "/Users/myuser"; "SIMulATOR_LEGACY_ASSET_SUFFIX" = iphone; "SIMulATOR_LOG_ROOT" = "/Users/myuser/library/Logs/CoreSimulator/DC33C1C6-5EBB-4156-9F1E-C1844955433D"; "SIMulATOR_MAINSCREEN_HEIGHT" = 1334; "SIMulATOR_MAINSCREEN_PITCH" = "326.000000"; "SIMulATOR_MAINSCREEN_SCALE" = "2.000000"; "SIMulATOR_MAINSCREEN_WIDTH" = 750; "SIMulATOR_MEMORY_WARNINGS" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/var/run/memory_warning_simulation"; "SIMulATOR_MODEL_IDENTIFIER" = "iPhone9,1"; "SIMulATOR_PLATFORM_RUNTIME_OVERLAY_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/library/CoreSimulator/RuntimeOverlay"; "SIMulATOR_PRODUCT_CLASS" = D10; "SIMulATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator.sdk"; "SIMulATOR_RUNTIME_BUILD_VERSION" = 14E269; "SIMulATOR_RUNTIME_VERSION" = "10.3"; "SIMulATOR_SHARED_RESOURCES_DIRECTORY" = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data"; "SIMulATOR_UDID" = "DC33C1C6-5EBB-4156-9F1E-C1844955433D"; "SIMulATOR_VERSION_INFO" = "CoreSimulator 375.20 - Device: iPhone 7 - Runtime: iOS 10.3 (14E269) - DeviceType: iPhone 7"; "TESTMANAGERD_SIM_SOCK" = "/private/tmp/com.apple.launchd.L8ty9mXSmp/com.apple.testmanagerd.unix-domain.socket"; TMPDIR = "/Users/myuser/library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272/tmp"; "xpc_FLAGS" = 0x0; "xpc_SERVICE_name" = "UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]"; "xpc_SIMulATOR_launchd_name" = "com.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim";}SpringBoard[34185]: [KeyboardArbiter] HW kbd: Failed to set (null) as keyboard focuscom.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim[34164] (UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190][34865]): Service exited with abnormal code: 1assertiond[34190]: Ignoring assertion request named "Deliver Message" from <BSProcessHandle: 0x7fd178711850; SpringBoard:34185; valID: YES> because process { pID 34865; bundleID (null) } is unkNown.assertiond[34190]: Deleted job with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]
更新:添加测试类代码
import XCTestclass VIEwControllersUITests: XCTestCase { func testTapNumberbuttonIncrementsscore() { let app = XCUIApplication() let numberbutton = app.buttons["numberbutton"] numberbutton.tap() let newscore = numberbutton.label XCTAssertEqual(newscore,"1") }}解决方法 啊,我觉得很蠢.看看另一个应用程序,我在我的测试类中缺少以下代码:
overrIDe func setUp() { super.setUp() continueAfterFailure = false XCUIApplication().launch()}
最重要的是XCUIApplication().launch()位.
总结以上是内存溢出为你收集整理的iOS UI测试失败,因为“应用程序未运行,无法获取辅助功能数据.你有没有打电话 – 发射?“全部内容,希望文章能够帮你解决iOS UI测试失败,因为“应用程序未运行,无法获取辅助功能数据.你有没有打电话 – 发射?“所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)