"Soft close" an app on iOS


is there a way to stop the application under test in a ‘clean’ way (having the application callbacks called) ?

Our iOS application under test needs to release some valuable server resource when being close/put in background. The issue is that Appium (probably Instruments’ fault) kills the app at test end and callbacks in the app are not called.
We tried to use ‘closeApp’ and ‘stopDriver’ and the result is the same.

Putting the app in background would be a valid option but the ‘runInBackground(…)’ command relaunches the app at the delay end, making it book some new server resources. We tried to call ‘runInBackground’ in a thread and stop the driver in the meantime; it works at first sight but brings some instabilities when run in a Jenkins server.

Any idea on how we could have the app be notified when stopped?

Thank you !

Hi @fdubuisson,

if nothing else works for you, you can try and activate the AssistiveTouch (under General -> Accessibility), Place it on a spot where it wont hurt any test and then on your clean up method just touch on it and again on Home icon to put app in background