---
title: Testing app upgrades and downgrades with Appium | TestingBot
description: Run automated tests with Appium, downgrade and upgrade your versions
  during the test.
source_url:
  html: https://testingbot.com/support/app-automate/appium/test-app-upgrades
  md: https://testingbot.com/support/app-automate/appium/test-app-upgrades/index.md
---
# Test App Upgrades/Mid-Session App Installations

As app developers, we frequently release new versions of our applications. In most cases, users upgrade from an older version rather than installing the app from scratch. This transition often requires migrating existing user data to ensure the app functions correctly, making upgrade testing a crucial step in development. By thoroughly testing upgrades, we can confirm that the app continues to work as expected post-update.

App upgrades aren't the only scenario where installing apps during a running session is necessary. Some applications may depend on other apps to function properly. If your app interacts with another application, such as pulling data or integrating with its features, it's essential to verify that these dependencies remain intact after an upgrade.

Additionally, there are cases where you might need to delete and reinstall an app during a session. For example, if you want to test how the app behaves when a user uninstalls and reinstalls it, the mid-session install feature can facilitate this process.

## (Re-)Installing apps during a test

Before you can install a new app, or a new version of the app, we encourage you to first upload your `.apk/.ipa/.zip` file to [TestingBot Storage](https://testingbot.com/support/app-automate/help/upload).

Alternatively, you can also specify a URL to an `.apk/.ipa/.zip` file that is publicly accessible.

During your test, you can use the `mobile:installApp` command to install the app on the device.

[Java](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Python](https://testingbot.com#)[Ruby](https://testingbot.com#)[C#](https://testingbot.com#)

    driver.executeScript("mobile: installApp", ImmutableMap.of("appPath", "tb://<file-name>.apk|ipa|zip"));

    await driver.execute('mobile: installApp', {"appPath": "tb://<file-name>.apk|ipa|zip"});

    driver.execute_script('mobile: installApp', {"appPath": "tb://<file-name>.apk|ipa|zip"})

    driver.execute_script('mobile: installApp', {"appPath" => "tb://<file-name>.apk|ipa|zip"})

    driver.ExecuteScript("mobile: installApp", new Dictionary<string, string> { { "appPath", "tb://<file-name>.apk|ipa|zip" } });

The `mobile: installApp` command returns no payload on success, Appium will throw an exception if the install fails. Use `mobile: queryAppState` (Android) or `mobile: isAppInstalled` to verify the install, and read the version from the app itself if needed.

Appium will not automatically launch the app after you installed it during the test. You can launch the app manually using the following commands after installation:

- **Android:** `mobile: startActivity`
- **iOS:** `mobile: activateApp` (`mobile: launchApp` is deprecated)

[Java](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Python](https://testingbot.com#)[Ruby](https://testingbot.com#)[C#](https://testingbot.com#)

    // Android
    driver.executeScript("mobile: startActivity", ImmutableMap.of("intent", "com.testingbot.demo/.MainActivity"));
    // iOS
    driver.executeScript("mobile: activateApp", ImmutableMap.of("bundleId", "com.testingbot.demo"));

    // Android
    await driver.execute('mobile: startActivity', {intent: 'com.testingbot.demo/.MainActivity'});
    // iOS
    await driver.execute('mobile: activateApp', {bundleId: 'com.testingbot.demo'});

    # Android
    driver.execute_script("mobile: startActivity", {"intent": "com.testingbot.demo/.MainActivity"})
    # iOS
    driver.execute_script("mobile: activateApp", {"bundleId": "com.testingbot.demo"})

    # Android
    @driver.execute_script("mobile: startActivity", {"intent" => "com.testingbot.demo/.MainActivity"})
    # iOS
    @driver.execute_script("mobile: activateApp", {"bundleId" => "com.testingbot.demo"})

    // Android
    driver.ExecuteScript("mobile: startActivity", new Dictionary<string, string> { { "intent", "com.testingbot.demo/.MainActivity" } });
    // iOS
    driver.ExecuteScript("mobile: activateApp", new Dictionary<string, string> { { "bundleId", "com.testingbot.demo" } });

## Removing your app during a test

To remove your app during a test, you can use the [`mobile: removeApp`](https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#mobile-removeapp) command.

[Java](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Python](https://testingbot.com#)[Ruby](https://testingbot.com#)[C#](https://testingbot.com#)

    // Android
    driver.executeScript("mobile: removeApp", ImmutableMap.of("appId", "com.testingbot.demo"));
    // iOS
    driver.executeScript("mobile: removeApp", ImmutableMap.of("bundleId", "com.testingbot.demo"));

    // Android
    await driver.execute('mobile: removeApp', {appId: 'com.testingbot.demo'});
    // iOS
    await driver.execute('mobile: removeApp', {bundleId: 'com.testingbot.demo'});

    # Android
    driver.execute_script("mobile: removeApp", {"appId": "com.testingbot.demo"})
    # iOS
    driver.execute_script("mobile: removeApp", {"bundleId": "com.testingbot.demo"})

    # Android
    @driver.execute_script("mobile: removeApp", {"appId" => "com.testingbot.demo"})
    # iOS
    @driver.execute_script("mobile: removeApp", {"bundleId" => "com.testingbot.demo"})

    // Android
    driver.ExecuteScript("mobile: removeApp", new Dictionary<string, string> { { "appId", "com.testingbot.demo" } });
    // iOS
    driver.ExecuteScript("mobile: removeApp", new Dictionary<string, string> { { "bundleId", "com.testingbot.demo" } });

## Other app commands

Appium supports more commands to handle apps during a test, such as:

### mobile: terminateApp

This will forcefully stop the app (specified by bundleId or appId) on the device.

### mobile: isAppInstalled

Verifies if the app (specified by bundleId or appId) is on the device. Returns a boolean true or false.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new)[Slack Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
