Appium

Appium is an open-source automation tool that allows you to automate the testing of mobile applications (both iOS and Android) using a unified and cross-platform framework. It enables the creation and execution of test scripts for mobile apps, making it easier to ensure their functionality and quality across different devices and operating systems.

1. Create an Appium Script

To run automated tests with BitBar, create an Appium test on your own computer using Appium's documentation as a guide.

Tip

When configuring your automated test runs in BitBar, you can generate sample scripts below. If you decide to use your test, not the sample one, then before running your test in BitBar, check that it functions correctly on your local machine.

2. Create an Automated Test in BitBar

  1. After logging into your BitBar account, click Automation on the left-hand menu, then select Create Automated Test. Alternatively, click the Create Automated Test button on the Automated Testing tile.

    Start creating an automated desktop test
  2. Select the mobile operating system on which you would like to execute the automated test.

  3. Select the Appium test framework.

    Table 3. Appium Framework Options

    Operating System

    Appium Framework Options

    iOS

    • Appium iOS Client Side

    • Server Side (Appium and other frameworks)

    • Server Side (Appium and other frameworks) with biometry

    Android

    • Appium Android Client Side

    • Server Side (Appium and other frameworks)



  4. Configure your test run, based on whether you require client-side or server-side testing:

    Client-side test configuration
    1. Click Mobile Web (Appium).

    2. Name your test project and test run.

    3. Select the nearest Hub Location for better performance.

    4. Update your test script with the Hub URL.

    5. Configure the Appium version, Device, and Browser for your test run (these are known as capabilities).

    6. BitBar will generate script code in commonly used languages and provide a preview. Select the Show full sample script checkbox to utilize the script code generated by BitBar.

    7. Copy the code by clicking and then paste it into your Selenium script on your computer.

    Server-side test configuration
    1. Select your files:

      Table 4. File Selection for Mobile OS

      Mobile Platform

      File Extension

      iOS

      • App with .ipa extension.

      • Test with .zip extension.

      Android

      • App with .apk or .aab extension.

      • Test with .zip extension.



    2. Select your devices:

      • Select existing device group

      • Use chosen devices

      • Use currently idle device(s)

    3. (Optional) Configure additional settings.

      Appium-configure-additional-settings.png

3. Capabilities Creator

To configure your test, select Capabilities Creator from the left-hand side menu.

  1. Click Mobile Web(Appium).

  2. Enter the name of your project and test run.

  3. Select the Hub Location that is closest to you to improve performance.

  4. Update your test script with the Hub URL.

  5. Set the combination of the operating system, Appium version, and device, for the test run (these and other settings are called capabilities).

    Note

    For iOS devices, the Appium version capability is provided in read-only mode. The Browser capability is also read-only for both iOS and Android.

  6. BitBar generates script code in popular languages and displays the code for preview.

4. Configure the Appium Script

Important

It is essential that you insert your API key to the copied script code and that you modify the Appium Grid address in your test.

Insert the API Key

  1. Get the API key from your BitBar account settings:

    1. Log in to BitBar, click the user icon and select My Account.

    2. Go to the My Integrations section, click API Access, and copy the API key value:

      Selenium-apiKey.png
  2. Set the API key as the value for the apiKey parameter:

    Table 5. API Key Configuration Samples

    Languages and Runtimes

    Sample

    Python

    capabilities = {
    	...
    	'bitbar:options': {
    		'apiKey': '<insert your BitBar API key here>',
    		...
    	}
    }
    

    Java

    MutableCapabilities capabilities = new MutableCapabilities();
    ...
    
    HashMap<String, String> bitbarOptions = new HashMap<String, String>();
    bitbarOptions.put("apiKey", "<insert your BitBar API key here>");
    ...

    C#

    DriverOptions capabilities = new DriverOptions();
    ...
    
    IDictionary<string, string> bitbarOptions = new Dictionary<string, string>();
    bitbarOptions.Add("apiKey", "<insert your BitBar API key here>");
    ...

    Ruby

    capabilities = Selenium::WebDriver::Remote::Capabilities.new({
    	...
    	'bitbar:options' => {
    		'apiKey' => '<insert your BitBar API key here>'
    		...
    	}
    })

    Node.js

    var capabilities = {
    	...
    	'bitbar:options': {
    		'apiKey': '<insert your BitBar API key here>',
    		...
    	}
    };


Set the Appium Grid Address

You need to modify the Appium Grid address in your test’s capabilities. The value to use depends on the target location, where the tested browser will run:

  • US: APPIUM – https://us-west-mobile-hub.bitbar.com/wd/hub

  • EU: APPIUM – https://eu-mobile-hub.bitbar.com/wd/hub

Now you are ready to run your test.

5. Run Your Test and View Results

Run your test as you would normally do this. The results will go to BitBar. You can view them on the Projects screen under the project and test run node, whose name you specified in capabilities:

Appium-last-test-runs.png

See Also

Publication date: