Server Side Appium

Server side Appium testing is when you upload your existing Appium tests to Bitbar Cloud and then either using the API or the cloud UI select and start test execution on multiple devices. The benefits of this approach are, you do not need to modify your Appium tests, execution of tests can be parallelized on multiple devices and you are informed when the execution is finished.

The below used sample code can be downloaded from our git repository.

Running Sample in Cloud

Packaging The Tests

All needed files for testing need to be uploaded to cloud as zip package. This package must contain test files, data files and needs to have a Shell script to launch test execution at the root level of the package.

The above sample has the following content:

$ ls -lrt
-rwxr-xr-x  1 user  staff    60 Feb 28 16:31 requirements.txt
-rw-r--r--  1 user  staff  4667 Mar  9 15:38
-rw-r--r--  1 user  staff  2687 Mar 13 11:04
-rwxr-xr-x  1 user  staff  1263 Mar 14 16:10
-rwxr-xr-x  1 user  staff  1382 Mar 14 16:11

Depending whether you are testing iOS or Android, you’ll need to rename or to depending which environment you want to test.

For the sake of this example, let’s decide we want to run an Android test, so we need to rename to

$ cp

Now creating the test zip (called here for upload is done as:

$ zip -r *
  adding: (deflated 67%)
  adding: (deflated 70%)
  adding: requirements.txt (deflated 2%)
  adding: (deflated 47%)
  adding: (deflated 47%)
  adding: (deflated 44%)

Note, the needs to always be at the root of the package.

Creating Project On Bitbar Cloud

  • Create a new project in the projects view
  • Create a new test run for this project
  • Upload tested application (apk/ipa) in the “Application” step
  • Upload the above created zip using the “Upload test file” step
  • Choose the device group to use or create a new group for this run
  • Select optional advanced options
  • Start testrun

Once the test execution has finished, test results become available in cloud.

Additional Considerations

To get all your test artifacts presented in Bitbar Cloud you should take the following additional steps into consideration.

  • In make sure that the ${TEST} variable points to correct file name. This is the name of the main Python test script file.
  • To get screenshots and test results visible in the cloud, make sure your test scripts store screenshots in a “screenshots” directory at the root of the test files directory.
  • Also if your tests create JUnit result files, name them as TEST-all.xml and locate it at the root of the test files directory

After a test run of this sample test the output should look like so.

$ ls -lrt
-rw-rw-r-- 1 user staff    4667 Jun  8 01:05
-rwxrwxr-x 1 user staff    1263 Jun  8 01:05
-rwxrwxr-x 1 user staff    1382 Jun  8 01:05
-rwxr-xr-x 1 user staff      60 Jun  8 01:05 requirements.txt
-rw-rw-r-- 1 user staff    2687 Jun  8 01:05
-rwxrwxr-x 1 user staff    1382 Jun  8 01:06
-rw-rw-r-- 1 user staff 1595408 Jun  8 01:09
-rw-rw-r-- 1 user staff    5572 Jun  8 01:09 TestdroidAppiumTest.pyc
drwxrwxr-x 2 user staff    4096 Jun  8 01:09 screenshots
-rw-rw-r-- 1 user staff    3129 Jun  8 01:09 TEST-all.xml
drwxrwxr-x 2 user staff    4096 Jun  8 01:09 test-reports

Running Sample Locally

This example works for both Android and iOS devices. Depending which you want to test, rename or to

To get started you need to have curl, unzip, appium and adb for Android or Xcode for iOS installed on your test machine. Rest of the required dependencies are listed in the requirements.txt file of this sample directory. The takes care of installing the remaining tools and libraries.

Changing Settings

  • Launch Appium server as normally when running local Appium tests. Appium for iOS needs device ID in launch parameters

  • In comment out, remove the lines or parametrize to fit your local environment needs the lines between

    ##### Cloud testrun dependencies start

    ##### Cloud testrun dependencies end.

  • assumes the tested apk/ipa is named as application.apk or application.ipa and is located at the root of the working directory. Alternatively update to use some other path.

  • Launch tests by running the script.

Java Based Sample

There is also a Java based sample at Github. The README has a more detailed explanation about the repository structure and how to use it.