Intermittent "Failure attempting to launch" in ios UITest
Asked Answered
V

1

6

I see this about 1/10 times with my UI Tests on Xcode7.3/iOS9.3

Test Case '-[WhatevUITests.RegistrationUITests testVerifyUnsupportedPhoneNumberAlert]' started.
    t =     0.00s     Start Test
    t =     0.00s     Set Up
    t =     0.01s         Launch me.jackpine.whatev-dev
    t =     0.11s             Terminate <XCUIApplicationProcess: 0x7ff91a712550 me.jackpine.whatev-dev (94280)>
    t =     1.14s             Assertion Failure: UI Testing Failure - Failure attempting to launch <XCUIApplicationImpl: 0x7ff91a49fae0 me.jackpine.whatev-dev at /Users/mkirk/src/jackpine/Whatev-iOS/build/Whatev/Build/Products/Debug-iphonesimulator/Whatev Dev.app>, nil token for current process reference <XCUIApplicationProcess: 0x7ff91a624440 me.jackpine.whatev-dev (94333)>
/Users/mkirk/src/jackpine/Whatev-iOS/WhatevUITests/RegistrationUITests.swift:16: error: -[WhatevUITests.RegistrationUITests testVerifyUnsupportedPhoneNumberAlert] : UI Testing Failure - Failure attempting to launch <XCUIApplicationImpl: 0x7ff91a49fae0 me.jackpine.whatev-dev at /Users/mkirk/src/jackpine/Whatev-iOS/build/Whatev/Build/Products/Debug-iphonesimulator/Whatev Dev.app>, nil token for current process reference <XCUIApplicationProcess: 0x7ff91a624440 me.jackpine.whatev-dev (94333)>
    t =     1.15s             Tear Down

I'm not sure what it means. Often I can rerun the test and it will complete without issue.

Vampire answered 4/4, 2016 at 21:18 Comment(4)
Also worth noting: I do not see this with the same UI tests on Xcode 7.2 / iOS 9.2Airminded
Can you post a small sample of your code that reproduces the failure? I may have a workaround but cannot say for sure without seeing your code.Airminded
Any update on this issue ?I am also facing similar issue Xcode 7.3.1Korn
Also seeing this in Xcode 8.2.1Quake
L
0

I had this issue with Xcode 8.3.2 and iOS 10.3 Simulator. All of the tests started failing after updating the Mac OS to Sierra.

We would see the above exception at:

XCUIApplication().launch()

and the first time the test tries to access the XCUIApplication() it crashes.

The fix was to move the XCUIApplication().launch() call to the setUp() function.

Background

In our case the problem was multithreading. We wanted to make sure some other code was executed before the app started. That code ran asynchronous and started the app once it returned. The fix makes sure that the app is launched first and on the main thread. Now everything works fine again.

Lemal answered 9/5, 2017 at 7:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.