UI Testing Failure - App state is still not terminated

When running my tests using xcodebuild on jenkins, specific tests will randomly fail causing builds to be unstable. I am currently calling XCUIApplication().terminate() in the teardowns of all the testcases as way to fix this. However, it does not seam to work. Ive also tried cleaning the build before each jenkins build but that also does not work. Has any one had or solved this issue when working with Jenkins?

Hi, I am running UI tests by an Xcode bot and have the same error. The tests start running fine at first, but after several successful runs they start all failing with this error: "app state is still not terminated". After the first test fails with this error - all tests after it fail as well. The only cure I found is to restart the server computer.

Please file bug reports (using the Report Bugs link at the bottom of this page). Thanks!

From what I have seem so far, http://masilotti.com/xctest-documentation/Classes/XCUIApplication.html#//api/name/terminate doesn't seem to kill the app but only suspend it. Is that what you are seeing too?

anybody see any fix or work around for this yet? We are still seeing it.

For our Jenkins build, we've been resetting the entire simulator between runs.


export DEV_NAME=UITest5s
xcrun simctl list devices | grep $DEV_NAME | awk '{print $1}' | xargs xcrun simctl delete
xcrun simctl create $DEV_NAME 'iPhone 5s' '9.0'
xcrun simctl erase $DEV_NAME
xcodebuild -workspace your.xcworkspace -scheme UITests -sdk iphonesimulator9.0 \
    -destination "name=UITest5s" test



We're still in the process of stress testing our Jenkins build, but with a single non-trivial UI test, we've gone through a hundred runs with 2 failures due to what look like some kind of build failure.

Just upgraded to 7.1 and seeing this error a lot more. On 7.0 on a small subset of tests via xcodebuild and jenkins it would only happend 1/20 but on xcode server it was more like 15/20. Now on 7.1 my jenkins is failing with app terminate error 19/20.


Anybody figure out a fix for this yet?


I saw 7.2 beta came out...maybe there?

Could it be pattern in way XCUIApplication() is called?

Please grab sysdiagnose reports when you're hitting this issue, and attach those to bug reports. Thanks!

I've filed

23453913


I ran the sysdiagnose command a couple of hours after the fail. Hope that's ok anyways.

Did they reply to your bug?

We haven't had a chance to reply to that radar yet. I'd be very interested to know if the problem persists in Xcode 7.2 beta 3?

This is the huge issuefor me with the latest version of xcode 7.1.1, i am not even running my test on ci yet

I can confirm that this error doesn't happen often to me anymore on XCode 7.2 beta 4

That's good to know. Thanks!

I am also experiencing this issue with 100% probability on Xcode 7.1.1. I run the tests from the Xcode without CI and I have to run them one by one, because otherwise they fail on the next [app launch/terminate] call.

I tried installing the latest Xcode 7.2 beta, but it made no difference.

I am experiencing this problem with the official 7.2 Xcode release. I put a dummy test between each of my real tests and the dummy test will fail but at least I get the real tests to work. I named my tests with numbers so they run in a certain order (not guaranteed but seems to work).

UI Testing Failure - App state is still not terminated
 
 
Q