jeudi 10 novembre 2016

How to run tests on android emulator without loading the emulator everytime?

How to run tests on Android emulator without loading the emulator everytime when I running tests?

I have the code:

void prepareAndroidEmulator() throws MalformedURLException {
        File appDir = new File("/Users/oleh/Google Drive/QA DRIVE/Applications/some/sprint 2");
        File app = new File(appDir, BUILD_NAME);

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("avd", "LG_G4._API_22._Android_5.1");

        capabilities.setCapability("deviceName", "AndroidTestDevice");
        capabilities.setCapability("platformName", "Android");

        capabilities.setCapability("app", app.getAbsolutePath());
        driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    }
      @BeforeClass
    public void setUp() throws Exception {
        prepareAndroidEmulator();

    }

    @AfterClass
    public void tearDown() throws Exception {
        driver.quit();
        Runtime.getRuntime().exec("adb -s emulator-5554 emu kill");
    }

I kill emulator specially because if I don't do it, next time I have an error or ide is skipping tests.

Screen about skipped tests

Main idea: I don't want to load and kill emulator everytime when I starting tests. I want to load emulator once and after use it all time, when I running test.

My environment:

-OS X El Capitan -Intellij IDEA -Selenium -Appium

Aucun commentaire:

Enregistrer un commentaire