Appium Check

Creating Build

Separately IPA and APK

Creating Test Zip

The tests are assumed to be in a zip-package that is unzipped and executed at check test run. Once the package is unzipped in an empty folder, that folder should contain any of the following for the test to be started successfully.

  • a run-tests.sh shell script that has all the necessary steps to start the execution of the test steps. This file is not mandatory if the unzipped file structure has a pom.xml file.

  • In case the above script is not available, then Bitbar Monitoring tries to run the Maven pom.xml assumed to be at the root, as mvn test. This should take care of all the steps needed to run the test.

An example zip package could look like this.

$ zipinfo zip-package.zip
Archive:  zip-package.zip
Zip file size: 3504 bytes, number of entries: 11
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/com/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/com/bitbar/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/com/bitbar/monitoring/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/com/bitbar/monitoring/samples/
drwxr-xr-x  3.0 unx        0 bx stor 17-Jan-16 14:45 src/test/java/com/bitbar/monitoring/samples/ios/
-rw-r--r--  3.0 unx     2187 tx defN 17-Jan-16 14:45 src/test/java/com/bitbar/monitoring/samples/ios/SafariSimulatorTest.java
-rw-r--r--  3.0 unx     1764 tx defN 17-Jan-16 14:45 pom.xml
-rw-r--r--  3.0 unx      152 tx defN 17-Jan-16 16:58 run-tests.sh

In this example the run-test.sh is redundant as the pom.xml file would be sufficient for the test to get started.

Results

The results should be in a standard Junit XML format for them to be properly parsed and presented in Bitbar Monitoring UI.

Appium Test

Appium supports running tests against native, hybrid and web iOS and Android mobile applications. Appium supports running web tests using Android Chrome and iOS Safari browsers.

To start an Appium test, a zip package as described above needs to be created. Appium is pre-installed on the hosts running tests and is started automatically. The run-tests.sh or pom.xml files only take care of starting test run execution.

$ ls -lrt
total 394
drwxr-xr-x  1 userA  staff     102 Jan 16 04:45 src
-rw-r--r--  1 userA  staff    1764 Jan 16 04:45 pom.xml
-rw-r--r--  1 userA  staff     152 Jan 16 06:58 run-tests.sh
-rw-r--r--  1 userA  staff    3504 Jan 16 06:59 buy-monitoring.zip
-rw-r--r--@ 1 userA  staff   67480 Jan 16 07:11 page_loading.png
-rw-r--r--@ 1 userA  staff  125295 Jan 16 07:12 page_loaded.png

In this example the run-tests.sh file is very simple.

$ cat run-tests.sh
#!/bin/bash

# starts execution of the Java Appium test using Maven and ./pom.xml file.

echo ">>> Starting test from run-tests.sh script <<<"
mvn test

Screenshots

To get screenshots visible in the Monitoring cloud checks view, all screenshots should be stored to a ./screenshots directory.

Eg. this is how screenshots are taken in the sample scripts:

private void takeScreenshot(String name) {
    try {
        File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        File testScreenshot = new File("screenshots", name);
        FileUtils.copyFile(scrFile, testScreenshot);
        ...

Supported Environment

In Bitbar Monitoring service, the default Appium setup supports tests written in Java. Sample tests are available at Bitbar’s Github samples.

Installed versions are Appium version: 1.5.3 and Java 8 (1.8.0_112).