Deutsch English
Start for free Deutsch Log in Register

Mobile app testing & automation with Appium

The use of the following test frameworks and test tools has been evaluated and tested. Other common frameworks and test tools are under evaluation. If you have any questions about using your preferred test tools, please feel free to contact us.

Appium Appium + Jetpack Compose XCUITest Espresso TestCafe Tosca Selenium

Test your native apps and web apps with Appium on the devices of the Mobile Device Cloud

With Appium, you can create automated tests for your Android, iOS and web applications without having to make any changes to the applications.

All Selenium API-compatible programming languages are available for developing your tests.

The Appium driver provides you with the familiar Selenium environment on our mobile devices.

import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import org.junit.*;
import org.openqa.selenium.By;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.MalformedURLException;
import java.net.URL;

public class LocaliOSTest {

    private String accessKey = "<ACCESS_KEY>";
    protected IOSDriver<IOSElement> driver = null;
    DesiredCapabilities dc = new DesiredCapabilities();

    @Before
    public void setUp() throws MalformedURLException {
        dc.setCapability("testName", "Quick Start iOS Native Demo");
        dc.setCapability("accessKey", accessKey);
        dc.setCapability("deviceQuery", "@os='ios' and @category='PHONE'");
        dc.setCapability(MobileCapabilityType.APP, "cloud:com.experitest.ExperiBank");
        dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "com.experitest.ExperiBank");
        driver = new IOSDriver<>(new URL("https://mobiledevicecloud-test.t-systems-mms.eu/wd/hub"), dc);
    }

    @Test
    public void quickStartiOSNativeDemo() {
        driver.rotate(ScreenOrientation.PORTRAIT);
        driver.findElement(By.xpath("//*[@id='usernameTextField']")).sendKeys("company");
        driver.hideKeyboard();
        driver.findElement(By.xpath("//*[@id='passwordTextField']")).sendKeys("company");
        driver.findElement(By.xpath("//*[@id='loginButton']")).click();
        driver.findElement(By.xpath("//*[@id='makePaymentButton']")).click();
        driver.findElement(By.xpath("//*[@id='phoneTextField']")).sendKeys("0541234567");
        driver.findElement(By.xpath("//*[@id='nameTextField']")).sendKeys("Jon Snow");
        driver.findElement(By.xpath("//*[@id='amountTextField']")).sendKeys("50");
        driver.findElement(By.xpath("//*[@id='countryButton']")).click();
        driver.findElement(By.xpath("//*[@id='Switzerland']")).click();
        driver.findElement(By.xpath("//*[@id='sendPaymentButton']")).click();
        driver.findElement(By.xpath("//*[@id='Yes']")).click();
    }

    @After
    public void tearDown() {
        System.out.println("Report URL: "+ driver.getCapabilities().getCapability("reportUrl"));
        driver.quit();
    }
}

First steps with Appium

1.

Integrate Appium into your test framework

2.

Configure the connection to our Mobile Device Cloud API

3.

Install your apps with Appium

4.

Control your apps with Appium

1. Integrate Appium into your test framework

Search in the list of Appium clients for your desired development language.

Follow the instructions of the repository to include the client.

2. Configure the connection to our Mobile Device Cloud API

Before your tests, initialise an Appium driver that you can use later to control and automate elements of your app.

The driver needs two pieces of information:

  • The private access key to your project in the Mobile Device Cloud - you must copy this from your account
  • The URL to the Appium server of the Mobile Device Cloud - this is always the same and does not need to be changed by you (https://mobiledevicecloud.t-systems-mms.eu/wd/hub)
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("accessKey", "<ACCESS_KEY>");
IOSDriver<IOSElement> driver = new IOSDriver<>(new URL("https://mobiledevicecloud.t-systems-mms.eu/wd/hub"), dc);

It is best to build the driver in the setup() method of your tests and to close it in the teardown() method.

Use the example above as a guide.

3. Install your apps with Appium

Upload your app to the Mobile Device Cloud and give the Appium driver the bundle ID of your app to launch it automatically.

dc.setCapability(MobileCapabilityType.APP, "cloud:<BUNDLE_ID>");

4. Control your apps with Appium

Use the Appium driver methods to automate your app:

findElement(...)
sendKeys(...)
hideKeyboard()
rotate(...)
...