4

I am trying to use appium to test one app with real mobile phone. It will spend 25s on startup. How to speed up?

appium-desktop version: 1.5
android os: 7.1

here is adb log

from appium import webdriver

class AppTester(object):
    """docstring for AppTester"""
    def __init__(self, command_executor, desired_capabilities):
        super(AppTester, self).__init__()
        self.driver = webdriver.Remote(command_executor, desired_capabilities)

    def click_ui_element(self, ui_selector):
        self.driver.find_element_by_android_uiautomator(ui_selector).click()

import time
from app_tester.tester import *

app_caps = {
    'platformName': 'Android',
    'deviceName': 'Android Emulator',
    'platformVersion': '7.1',
    'appPackage': 'com.freescale.kinetisbletoolbox',
    'appActivity': 'com.freescale.bletoolbox.activity.CheckActivity',
    'autoGrantPermissions': True,
    # 'locationServicesAuthorized': True,
    'autoAcceptAlerts': True,
    # 'gpsEnabled': True,
    'noReset': True,
    'fullReset': False,
}

app_url = 'http://localhost:4723/wd/hub'

secs = time.time()
app = AppTester(app_url, app_caps)
print 'start App assume %ds'%(time.time()-secs)
app.click_ui_element('new UiSelector().text("Beacons")')
print 'click ui spends %ds'%(time.time()-secs)
jsplyy
  • 59
  • 6

2 Answers2

4

Thats pretty normal (~25 sec) to start Appium session on real devices based on my experience with local devices & clouds like SauceLabs/TestDroid.

Check Appium service logs:

09:25:00 - 09:25:19

  • checking available devices
  • checking appium.settings app on device & granting permissions to it
  • checking appium.unlock app

Pretty ok for 7.x Android real devices

09:25:23 - log states your session created. 23 sec without AUT installation, nothing to complain actually :)

You still can do it only once before tests suite, and then use same session for running all the tests. Thats how you can save time.

dmle
  • 3,498
  • 1
  • 14
  • 22
2

You can get a massive boost in startup time by adding the following capabilities. For me it takes it from 24 seconds down to 17 when using a local real Android device. The only thing is that the test app and the appium server helper needs to already have been installed on your device from a previous run.

DesiredCapabilities caps = new DesiredCapabilities();
   caps.setCapability("skipDeviceInitialization", true);
    caps.setCapability("skipServerInstallation", true);
    caps.setCapability("ignoreUnimportantViews", true);
    caps.setCapability("appPackage", "your.app.package");
    caps.setCapability("appActivity", "your.apps.activity.to.launch");

credit and explanation

HRVHackers
  • 2,793
  • 4
  • 36
  • 38