Remote TestKit

Device Cloud for
Mobile App Testing

Tutorial for Appium Features

Overview

Appium is a test framework to automate testing on a smartphone or tablet.

Previously, automated testing with Remote TestKit was possible using an Appium environment built on a local computer by using the virtual ADB and Xcode connector features. In June 2018 release, Appium test script can now run easily without building an Appium server environment and a link can also be easily made with CI environment.

* Remote TestKit Appium Cloud is available only to customers who have a Flat 3 or higher plan.

Appium Links Supported by Remote TestKit

An Appium Environment that Does Not Use Remote TestKit

Generally, a run environment, such as Node.js or an Appium server, must be built on a local computer that runs Appium, the test script created and then run in order to automate testing with Appium, as shown in the figure below.

Moreover, only a test device connected to a local computer could be used as the device used for the test script and in many cases an Android/iOS simulator had to be used.

An Appium Environment that Uses the Conventional Remote TestKit Features

In the past, it was possible with Remote TestKit to build an Appium environment that used a device on the cloud by using the virtual ADB and Xcode connector features. In this configuration, the link between a cloud hosted device and local environment is established at lower layer, which has the merit of enabling links to test frameworks other than Appium.
Note: Some features are limited in debuggers that use Xcode in iOS devices.

An Appium Environment that Uses New Remote TestKit Features

By using the features in the June 2018 update, automated testing using Appium is possible without building a Node.js, Appium server, or similar run environment. The only thing user needs to prepare is test script. Moreover, by using this feature, links to a CI environment inside or outside of a company can easily be achieved. You can focus on the task of creating test script. An Appium environment that uses the new features is shown below.
Note: At the time of this release, only devices running Android 4.4 or later and iOS 10.3 or later are supported.

Comparison of Appium Environments

The following chart compares the three environments listed above.

Environment that uses new RTK features Environment that uses conventional RTK features Environment that does not use RTK
Building of a server environment Not required Required Required
Client library Required Required Required
Physical Test smartphoneDevices Not required Not required Required
Test script run location Local computer Local computer Local computer
Linksing to toolss other than Appium Not supported Supported Supported
Difficulty of Integration with CI linking Easy Linking using the Devices need to be used through Thrift API is required Difficult

Resolving Issues

One of the challenges implementing automated testing within Continuous Integration (CI) tool is testing on physical devices. By using the new Appium features, the test script can now run on physical devices from CI services comparatively more easily than in the past.

Appium test script can run on devices within Remote TestKit from Jenkins or other CI environments built in-house.

How to Connect Appium Using the New Features

By just changing the Capabilities settings for the test script running in the Appium environment on the local computer, the server-side Appium features can be used.
The following is an explanation using an example test script written in Python. First of all, prepare a PC that Python can works.

Installing Appium Client Library

Follow the procedure below to install the Appium client library.

pip3 install Appium-Python-Client==3.1.0
or
pip install Appium-Python-Client==3.1.0

Explanation of the Destination

When running a test script on a local computer, specify "https://gwjp.appkitbox.com/wd/hub" for "http://localhost:4723/wd/hub" as the destination for the Appium client (test script).

・Example Python code

caps = {
    ...
}
options = AppiumOptions()
for k in caps:
    options.set_capability(k, caps[k])
self.driver = webdriver.Remote(
    # 'http://localhost:4723/wd/hub', options=options
    "https://gwjp.appkitbox.com/wd/hub", options=options
)

User Authentication

Specify Remote TestKit user name and password or access Token in Capabilities to connect to the Appium client. Also, the access token can be generated from Remote TestKit Software.

Capabilities name Value
userName Remote TestKit user name
password Remote TestKit password
access Token Remote TestKit access Token

・Example Python code (authenticate with username and password)

caps = {
    ...
    'userName': 'Remote TestKit user name',
    'password': 'Remote TestKit password',
    ...
}


・Example Python code (Authenticate with accessToken)

caps = {
    ...
    'accessToken': 'Remote TestKit access Token',
    ...
}

・How to get the access tokens

The access tokens can be generated from Remote TestKit software. Click the "Manage access token" right side menu. To regenerate the access token, click the regenerate button.

Selecting a Appium version

For Android devices, Appium 1.7.2, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.11.0, 1.11.1, 1.12.0, 1.12.1, 1.13.0, 1.14.0, 1.14.2, 1.15.1, 1.16.0, 1.17.0, 1.17.1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.19.0, 1.19.1, 1.20.0, 1.20.1, 1.20.2, 1.21.0, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 2.0.0, 2.0.1, 2.1.3, 2.2.2, 2.3.0, 2.4.1, 2.5.0, 2.5.1, 2.5.4, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.1, 2.10.2, 2.10.3, 2.11.0, 2.11.1, 2.11.2 runs on Remote Testkit, Appium version specification is possible with capability, default is 2.11.2.
For iOS devices, Appium versions are determined automatically, so capability can not be specified.Please make sure the test script written on your side is compatible with supported versions on Remote TestKIt.

Capabilities name Value
appiumVersion Specify from "1.7.2, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.11.0, 1.11.1, 1.12.0, 1.12.1, 1.13.0, 1.14.0, 1.14.2, 1.15.1, 1.16.0, 1.17.0, 1.17.1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.19.0, 1.19.1, 1.20.0, 1.20.1, 1.20.2, 1.21.0, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 2.0.0, 2.0.1, 2.1.3, 2.2.2, 2.3.0, 2.4.1, 2.5.0, 2.5.1, 2.5.4, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.1, 2.10.2, 2.10.3, 2.11.0, 2.11.1, 2.11.2"

The iOS device cannot specify a detailed version; it is a fixed version that depends on the version of Appium configured on the server to which the iOS device is connected. 1.x and 2.x versions can be switched by specifying the version in Capabilities above, depending on the iOS version. Capabilities above to switch between 1.x and 2.x versions.

iOS Version Appium 1.x Appium 2.x Not specified
iOS 18.x Unavailable 2.0.0 2.0.0
iOS 17.x Unavailable 2.0.0 2.0.0
iOS 16.x 1.22.3 2.0.0 2.0.0
iOS 15.x 1.22.3 2.0.0 2.0.0
iOS 14.x 1.22.3 2.0.0 2.0.0
iOS 13.x 1.22.3 Unavailable 1.22.3
iOS 12.x 1.19.1 Unavailable 1.19.1
iOS 11.x 1.19.1 Unavailable 1.19.1
iOS 10.x 1.19.1 Unavailable 1.19.1

Selecting a Device

The device to run Appium can be selected by the device name only or the device name and version. Regular expression can also be used to specify the device name.

Capabilities name Value
platformName Specify "Android" or "iOS"
deviceName Specify the device name
Determined in the following order: "Match all" -> "Match front with space delimiter" -> "Match front regular expression" (not case sensitive)

・Example Python code (with Nexus 7 specified)

caps = {
    ...
    platformName: 'Android',
    deviceName: 'Pixel 7',
    ...
}
Capabilities name Value
platformName Specify "Android" or "iOS"
deviceName Specify the device name
Determined in the following order: "Match all" → "Match front with space delimiter" → "Match front regular expression" (not case sensitive)
platformVersion Specify the version
Specify the part excluding "Android" "iOS" in the OS column of the computer client
Determined in the following order: "Match all" → "Match front regular expression"

・Example Python code (with Pixel 9 version 15 specified)

caps = {
    ...
    'platformName': 'Android',
    'deviceName': 'Pixel 9',
    'platformVersion': '15',
    ...
}

・Example Python code (with iPhone 16 version 18 specified)

caps = {
    ...
    'platformName': 'iOS',
    'deviceName': 'iPhone 16',
    'platformVersion': '18',
    'udid': 'XXXXXXXX',
    ...
}

Installing the App

Method 1.

Upload apk or ipa file to a public server which can be accessed from Remote TestKit and specify the Capabilities below.
Note: If necessary, add settings to permit access from Remote TestKit to the internal firewall. To find the access source IP address, Contact us.

Capabilities name Value
app Specify the URL of the uploaded apk or ipa
bundleId Specify the bundleId of ipa. Required parameter for ipa.

・Example Python code

caps = {
    ...
    'app': 'https://github.com/remotetestkit/sample-code/raw/master/appium/apk/RTKappium.apk',
    ...
}

Method 2.

Log in to the Software version of Remote TestKit and add the apk or ipa at [Device list] - [Menu] - [App Storage settings] from right side menu. Next, specify the following Capabilities.

Capabilities name Value
app Specify the file name of the uploaded apk or ipa
If multiple files with the same name are uploaded, the latest uploaded file will be used.

・Example Python code

caps = {
    ...
    'app': 'RTKappium.apk',
    ...
}

Designation of automatic re-signature features.

Automatic re-signing is performed when the ipa file is installed. If necessary, automatic re-signing can be switched off by specifying the following Capabilities.

Capabilities name Value
resigningEnabled True or False (*Automatic re-signing is switched off when False is specified).

・Example Python code

caps = {
    ...
    'resigningEnabled': True,
    ...
}

Checking the Test Screen in Progress

After connecting to the Appium server, a snapshotUrl is issued in order to obtain screens. Use Capability to obtain the snapshotUrl. The currently running screen can be viewed by opening the snapshotUrl in a browser.

・Example Python code

snapshotUrl = self.driver.capabilities['snapshotUrl']

Obtaining the Appium server log

After connecting to the Appium server, a serverLogUrl is issued in order to obtain appium server log. Use Capability to obtain the serverLogUrl. The currently running appium server log can be viewed by opening the serverLogUrl in a browser. The appium log is the latest 10-minutes log. At this time, logs can be obtained only for Android.

Capabilities name Value
logLevel Specify "info", "warn", "error", "debug". The default value is "info"

・Example Python code

caps = {
    ...
    'logLevel': 'info',
    ...
}

serverLogUrl = @driver.capabilities['serverLogUrl']

Forced deletion of Appium sessions

When an Appium test case is executed, if the session is not deleted normally, such as when an error occurs or the client is forced to terminate, the session will remain, but when the test is performed again with the same terminal specified conditions, the session can be overwritten and the test can be executed again with the same terminal. However, when the test is performed again with the same terminal specification conditions, it is possible to overwrite the session and run the test again with the same terminal. However, since the session is overwritten in this case, it is not possible to test multiple terminals simultaneously with the same capability. If you wish to test multiple terminals simultaneously, set the "noSessionOverwriting" capability to true (boolean). This will ensure that the terminal being used in the Appium Gateway session is skipped from the terminal selection and the session will not be overwritten.

Capabilities name Value
noSessionOverwriting Specify either true or false. Default value is false.

・Example Python code

caps = {
    ...
    'noSessionOverwriting': True,
    ...
}

Automatic Return of a Rented Device

If the same device is not accessed via the Appium server for the specified time, it will be returned automatically. If not specified, it will be returned automatically after 10 minutes.

Capabilities name Value
deviceKeepingTimeout Notation of "300000 to 1800000" [milliseconds]. Specify a time between 5 and 30 minutes.

・Example Python code

caps = {
    ...
    'deviceKeepingTimeout': 15 * 60 * 1000,
    ...
}

Automatic Extension of a Rented Device

If the same device is accessed via the Appium server with less than ten minutes of rental time left, rental time is automatically extended by 30 minutes.

Forced return of a Rented Device

The Rented Device is automatically returned when not in use, but if you want to perform automatic verification on another Device immediately, you can forcibly return the Device. A returnDeviceUrl is issued while running the test code. You can forcibly return the device by using the capability to get the returnDeviceUrl and accessing the corresponding URL in the test code.

・Example Python code

returnDeviceUrl = self.driver.capabilities['returnDeviceUrl']
exec_command = 'curl ' + returnDeviceUrl
subprocess.Popen(exec_command, shell=True)

Running on latest Chrome Driver

If it does not work with the latest Chrome Driver, you need to add the following setting to Capability.

・Example Python code

caps = {
    ...
    'chromeOptions': {'w3c': False},
    ...
}

A Python Test Script that Performs a Google Search

Save the following test script with the name of test.py or the like to the local computer.

import os
import sys
import unittest

from time import sleep
from appium import webdriver
from selenium.webdriver.common.by import By
from appium.options.common import AppiumOptions
import warnings

# get userName, password from Environment variable
RTK_USERNAME = os.environ.get('RTK_USERNAME')
RTK_PASSWORD = os.environ.get('RTK_PASSWORD')
if not RTK_USERNAME or not RTK_PASSWORD:
    print("Environment variable error")
    sys.exit()


class OpenUrlTest(unittest.TestCase):
    def setUp(self):
        caps = {
            'userName': RTK_USERNAME,
            'password': RTK_PASSWORD,
            'deviceName': 'Pixel',
            'platformName': 'Android',
            'browserName': 'Chrome',
            'appiumVersion': '2.11.2',
            'automationName': 'UiAutomator2',
            'chromeOptions': {'w3c': False}
        }
        warnings.filterwarnings("ignore", category=DeprecationWarning)
        options = AppiumOptions()
        for k in caps:
            options.set_capability(k, caps[k])
        self.driver = webdriver.Remote(
            "https://gwjp.appkitbox.com/wd/hub", options=options
        )
        print(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test_google_search(self):
        print(self.driver.capabilities['snapshotUrl'])
        # Open URL
        url = "https://www.google.com/"
        print("Open URL: " + url)
        self.driver.get(url)
        element = self.driver.find_element(By.CSS_SELECTOR, 'textarea')
        sleep(5)
        self.driver.save_screenshot('capture_01.png')

        # Input keys
        word = "Remote testKit"
        print("Input Keys: " + word)
        element.send_keys(word)
        element.submit
        sleep(5)
        self.driver.save_screenshot('capture_02.png')

        # Get value
        value = self.driver.find_element(By.CSS_SELECTOR, 'textarea').get_attribute('value')
        print("Text field value=" + value)
        self.assertEqual(value, "Remote testKit")


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(OpenUrlTest)
    unittest.TextTestRunner(verbosity=2).run(suite)

A Python Test Script that Performs a Calculation on iPhone device

Save the following test script with the name of test.py or the like to the local computer.

import os
import sys
import unittest

from appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
from appium.options.common import AppiumOptions
import warnings

# get userName, password from Environment variable
RTK_USERNAME = os.environ.get('RTK_USERNAME')
RTK_PASSWORD = os.environ.get('RTK_PASSWORD')
if not RTK_USERNAME or not RTK_PASSWORD:
    print("Environment variable error")
    sys.exit()


class OpenUrlTest(unittest.TestCase):
    def setUp(self):
        caps = {
            'userName': RTK_USERNAME,
            'password': RTK_PASSWORD,
            'logLevel': 'info',
            'platformName': 'iOS',
            'deviceName': 'iPhone 7.*',
            'platformVersion': '12',
            'bundleId': 'com.apple.calculator',
            'automationName': 'XCUITest'
        }
        warnings.filterwarnings("ignore", category=DeprecationWarning)
        options = AppiumOptions()
        for k in caps:
            options.set_capability(k, caps[k])
        self.driver = webdriver.Remote(
            "https://gwjp.appkitbox.com/wd/hub", options=options
        )
        print(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test_calculator(self):
        print(self.driver.capabilities['snapshotUrl'])

        driver = self.driver
        self.driver.save_screenshot('capture_01.png')

        el1 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "1")
        el1.click()
        self.driver.save_screenshot('capture_02.png')

        is_lang_english = True
        try:
            el2 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "multiply")
            el2.click()
        except Exception:
            is_lang_english = False
            el2 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "乗算")
            el2.click()
        self.driver.save_screenshot('capture_03.png')

        el3 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "3")
        el3.click()
        self.driver.save_screenshot('capture_04.png')

        el2.click()
        self.driver.save_screenshot('capture_05.png')

        el3.click()
        self.driver.save_screenshot('capture_06.png')

        if is_lang_english:
            el4 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "equals")
            el4.click()
            self.driver.save_screenshot('capture_07.png')

            el5 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "Result")
            value = el5.get_attribute('value')

            print("Text field value=" + value)
            self.assertEqual(value, "9")

            el6 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "clear")
            el6.click()
            self.driver.save_screenshot('capture_08.png')
        else:
            el4 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "計算実行")
            el4.click()
            self.driver.save_screenshot('capture_07.png')

            el5 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "結果")
            value = el5.get_attribute('value')

            print("Text field value=" + value)
            self.assertEqual(value, "9")

            el6 = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "消去")
            el6.click()
            self.driver.save_screenshot('capture_08.png')


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(OpenUrlTest)
    unittest.TextTestRunner(verbosity=2).run(suite)

When running this test script, set the Remote TestKit user name and password in an environmental variable. Use a terminal to run the following command.

export RTK_USERNAME=xxxx
export RTK_PASSWORD=xxxx

Connect to Appium Cloud through Proxy

Whether or not Proxy support is supported depends on the library in which the test script is written.
For example, since Python does not support Proxy support by default, use MonkeyPatch as follows.
Set the PROXY_URL in the sample code according to your environment.

import os
import sys
import unittest
from time import sleep
from appium import webdriver
from selenium.webdriver.common.by import By
from appium.options.common import AppiumOptions

# ------------------------------------------------------------------------------------------
# The original selenium.webdriver.remote.remote_connection is not implemented to access
# the endpoint via proxy. So We wrote a monkey patch for the proxy.
import certifi
import urllib3
from selenium.webdriver.remote.remote_connection import RemoteConnection

RemoteConnection.__org__init__ = RemoteConnection.__init__


def patch_init(self, remote_server_addr, keep_alive=False, ignore_proxy=False):
    print("\nMonkey patch version: selenium.webdriver.remote.remote_connection")
    RemoteConnection.__org__init__(self, remote_server_addr, keep_alive=keep_alive, ignore_proxy=ignore_proxy)

    if keep_alive:
        # Define proxy. Default value is squid port.
        PROXY_URL = "http://localhost:3128"
        self._conn = urllib3.ProxyManager(proxy_url=PROXY_URL, timeout=self._timeout)

        # If basic authentication is required, uncomment the following and define it.
        # headers = urllib3.util.make_headers(proxy_basic_auth="userid:password")
        # self._conn = urllib3.ProxyManager(
        #     proxy_url=PROXY_URL, proxy_headers=headers, cert_reqs='CERT_REQUIRED', ca_certs=certifi.where())


RemoteConnection.__init__ = patch_init
# ------------------------------------------------------------------------------------------

# Specify userName, password to Environment variable
RTK_ACCESSTOKEN = os.environ.get('RTK_ACCESSTOKEN')

if not RTK_ACCESSTOKEN:
    print("Environment variable error")
    sys.exit()


class OpenUrlTest(unittest.TestCase):
    def setUp(self):
        caps = {
            'accessToken': RTK_ACCESSTOKEN,
            'deviceName': 'Pixel',
            'platformName': 'Android',
            'browserName': 'Chrome',
            'appiumVersion': '1.22.3',
            'automationName': 'UiAutomator2',
            'chromeOptions': {'w3c': False}
        }
        # Specify the endpoint
        options = AppiumOptions()
        for k in caps:
            options.set_capability(k, caps[k])
        self.driver = webdriver.Remote(
            "https://gwjp.appkitbox.com/wd/hub", options=options
        )
        print(f"command_executor={self.driver.command_executor}")
        print(f"proxy={self.driver.command_executor._conn.proxy}")

    def tearDown(self):
        self.driver.quit()

    def test_google_search(self):
        # print(self.driver.capabilities['snapshotUrl'])
        # Open URL
        url = "https://www.google.com/"
        print("Open URL: " + url)
        self.driver.get(url)
        element = self.driver.find_element(By.CSS_SELECTOR, 'textarea')
        sleep(5)
        self.driver.save_screenshot('capture_01.png')

        # Input keys
        word = "Remote testKit"
        print("Input Keys: " + word)
        element.send_keys(word)
        element.submit
        sleep(5)
        self.driver.save_screenshot('capture_02.png')

        # Get value
        value = self.driver.find_element(By.CSS_SELECTOR, 'textarea').get_attribute('value')
        print("Text field value=" + value)
        self.assertEqual(value, "Remote testKit")


if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(OpenUrlTest)
    unittest.TextTestRunner(verbosity=2).run(suite)

Rest API

Uploading apps to shared storage using the API

Remote TestKit has an application storage feature. This is the ability to upload application files to storage via the PC client menu.
As an alternative to this menu, apps can also be uploaded to storage from the command line using the REST API. This is a useful feature for customers and others who are using a CI environment.

Overview

Upload the apk / ipa file to Remote TestKit storage using the API.

URL

https://gwjp.appkitbox.com/storage/xxxxxxxx

Specify the name of the file to be uploaded in xxxxxxxxxx.

Method Type

POST

Example of execution with curl command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
RTK_FILENAME=xxxxxxxx
curl -u $RTK_USERNAME:$RTK_ACCESSTOKEN -X POST -H 'Content-Type: application/octet-stream' https://gwjp.appkitbox.com/storage/$RTK_FILENAME --data-binary @/some/path/to/file

Notes

The following notes apply to the use of the API.

Retrieve Shared Storage Application List Using the API

You can retrieve a list of available shared storage applications using the REST API.

Overview

Retrieve a list of shared storage applications available in Remote TestKit using the API.

URL

https://gwjp.appkitbox.com/storage

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN https://gwjp.appkitbox.com/storage

Shared Storage Application Installation Using the API

You can install a shared storage application on a rented device from the command line using the REST API.¶

Overview

Install an apk/ipa file from shared storage on a specified device using the API.

URL

https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/storage/$RTK_FILENAME

Method Type

POST

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
RTK_FILENAME=xxxxxxxx
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" -X POST "https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/storage/$RTK_FILENAME"

Note

Shared Storage Application Deleting Using the API

You can delete applications from shared storage using the REST API.

Over

Delete a shared storage application from Remote TestKit using the API.

URL

https://gwjp.appkitbox.com/devices/$RTK_FILENAME

Method Type

DELETE

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
RTK_FILENAME=xxxxxxxx
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" "https://gwjp.appkitbox.com/devices/$RTK_FILENAME" -X DELETE

App Installation Using the API

You can install an application on a rented device from the command line using the REST API.

Overview

Install an apk/ipa file on a specified device using the API.

URL

https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/applications

Method Type

POST

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" -X POST -H 'Content-Type: application/octet-stream' "https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/applications" --data-binary @/some/path/to/file

Note

Retrieve Device List Using the API

You can retrieve a list of available devices using the REST API.

Overview

Retrieve a list of devices available in Remote TestKit using the API.

URL

https://gwjp.appkitbox.com/devices

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN https://gwjp.appkitbox.com/devices

Rent a Device Using the API

You can rent an available device using the REST API.

Overview

Rent a device from Remote TestKit using the API.

URL

https://gwjp.appkitbox.com/devices/$DEVICE_ID/rental

Method Type

POST

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN "https://gwjp.appkitbox.com/devices/$DEVICE_ID/rental" -X POST

Return a Device Using the API

You can return a rented device using the REST API.

Overview

Return a device from Remote TestKit using the API.

URL

https://gwjp.appkitbox.com/devices/$DEVICE_ID/rental

Method Type

DELETE

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN "https://gwjp.appkitbox.com/devices/$DEVICE_ID/rental" -X DELETE

Retrieve Device Logs Using the API

You can retrieve the logs of a rented device using the REST API.

Overview

Retrieve the logs of a Remote TestKit device using the API.

URL

https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/device_log

Method Type

GET

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN -X GET "https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/device_log"

Retrieve Appium Logs Using the API

You can retrieve the Appium logs of a device that has executed an Appium session using the REST API.

Overview

Retrieve the Appium logs of a Remote TestKit device using the API.

URL

https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/server_logs

Method Type

GET

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -u $RTK_USERNAME:$RTK_ACCESSTOKEN -X GET "https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/server_logs"

Note

Getting DeviceStats for a device using the API

You can use the REST API to retrieve the DeviceStats of a device on rental.

Overview

Get the DeviceStatus of a device on rental using the API

URL

https://gwjp.appkitbox.com/rented-devices/$DEVICE_ID/device_stats

Method Type

POST, GET

Example Using the curl Command

RTK_USERNAME=xxxxxxxx
RTK_ACCESSTOKEN=xxxxxxxx
DEVICE_ID=xxxxxxxx
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" -X POST "$RTK_APPIUM/rented-devices/$DEVICE_ID/device_stats/start"
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" -X POST "$RTK_APPIUM/rented-devices/$DEVICE_ID/device_stats/stop"
curl -s -H "Authorization: Bearer $RTK_ACCESSTOKEN" -X GET "$RTK_APPIUM/rented-devices/$DEVICE_ID/device_stats"

Note

Other Sample Codes

For other languages and test script sample codes, see the following repository.

https://github.com/remotetestkit/sample-code

Technical Specifications and Limitations

As of Feb 2025, features are provided as the beta version. At the time of this release, the following are known limitations:

List of errors that can occur in Remote TestKit Appium Cloud.

If the test script you run terminates abnormally with an error, the error message generated on the server side is returned via the Appium Client library. The error messages that follow ‘The environment you requested was unavailable’ and the causes are as follows. Please use this information to modify your test scripts.

Error Message Cause
An unknown server-side error occurred while processing the command. Original error: Appium Cloud server internal error
No 'deviceName' is specified. Incorrect deviceName in capability.
'platformName' is not 'Android' or 'iOS'. Incorrect platformName for capability.
No 'platformName' is specified. Incorrect platformName for capability.
No 'elementName' is specified. Incorrect Capability elementName.
Access to Appium Cloud is limited to FLAT upper rank plans. No FLAT contract.
Installing application failed. Cannot install an application downloaded from a URL
failed to get application response body Application file downloaded from URL is incorrect
Login with access token failed: clientAddress = access token error
Installing application failed. Application installation error
Application file is not uploaded. Application file not uploaded.
User storage is not permitted. Shared storage error
Login for sub-account user failed: loginIdentifier = Sub-account login error
No device is rentable because of no matched device No devices matching the conditions exist
Session is not created Session establishment failed
A session is either terminated or not started Session terminated or session establishment failed
An connection error occurred. Disconnected
Activating the device failed. Failed device rental
Device is not rentable Failed device rental
No device is rentable. Failed device rental
Application file name must contain alphabets only. File names must be non-alphabetic
Destroying old session failed Failed to destroy old session
Connection source IP address is invalid. Disconnection from unauthorised IP addresses
No device is rentable because rented devices reaches the maximum of your plan: maxRentableDeviceCount = The number of devices on rent has reached the maximum number that can be rented
Device is not launchable Failed to activate the rented device
Device is not launchable because its operation was aborted Failed to activate the rented device
Device is unavailabe without known reasons No devices available for rent
a pair of username and password, or an accessToken is required. login error
Login failed because of invalid login identifier: loginIdentifier = login error
Login failed: loginIdentifier = login error
User name is invalid login error
Could not rent a device that meets your criteria Failed to rent a device matching the criteria
You have exceeded the number of sessions you can connect to. Number of sessions available for connection exceeded