How to automatically uninstall application after failed test

Hi there
Each mobile test has the last line of “unistall the app”.
I have an execution test that will work 24 hours a day and I faced this problem. How to automatically uninstall an application that did not pass the test, so that the new test passes to a fresh installation (as usual)
maybe after each step in case i need to add conditions (if correct, say me how)

Hi @pn1,

Please try this:

import io.appium.java_client.InteractsWithApps

InteractsWithApps driver = MobileDriverFactory.getDriver()

driver.removeApp('your app id here')


if this is how you are setting your app, Mobile.startApplication(apkPath, true)

Mobile.closeApplication() will delete the app after execution.

In case of the failure, you can use the TearDown and use this if you don’t want to hardcode the package name.

def uninstallzIPS() {