Does the terminate command kill the app in XCUIApplication

I have started to experiment with Xcode UI testing and with in my first few tests, I am observing that the app state is being retained between tests.


How I kill the app completely?


http://masilotti.com/xctest-documentation/Classes/XCUIApplication.html#//api/name/terminate

command only seems to put the app in background/suspend it

Answered by Developer Tools Engineer in 715535022

The XCUIApplication method terminate does terminate the running instance of the app, and does not only send it to the background in iOS

https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate

The XCUIApplication method terminate does terminate the running instance of the app, and does not only send it to the background in iOS

https://developer.apple.com/documentation/xctest/xcuiapplication/1500637-terminate

I am experiencing this same behavior under iOS 17.0. It works under 16.4.

I tested this on three Simulator configurations

iPhone 8+ 16.4 : terminate() works as expected

iPhone 14 Pro 16.4 iPhone 15 Pro 17.0 terminate() suspends the app instead of terminating it.

Does the terminate command kill the app in XCUIApplication
 
 
Q