Connection String for a Mobile Device

The connection string specifies which mobile device is used for testing. When performing mobile testing, Silk Test Workbench uses the connection string to connect to the mobile device. The connection string is typically part of the application configuration. You can set the connection string when you configure your application under test. To change the connection string, you can use the Edit Application Configuration dialog box.

Note: If you execute a test from Silk Central, specify the mobile device in the Mobile Device Selection area of the Deployment tab of the execution definition in Silk Central instead of specifying a connection string. For additional information, refer to the Silk Central Help.
You can use the connection string to specify a specific mobile device, or you can filter a subset of the available devices, for example if you have a device pool. The first matching device is used for replay. If not specified otherwise, mobile devices are matched by using the following rules, with declining priority:
  • Matching mobile devices connected to the local machine are preferred over mobile devices connected to remote locations.
  • If the browser type is specified in the connection string, newer browser versions are preferred over older versions.
  • Newer platforms are preferred over older platforms.
  • A physical device is preferred to an Emulator or Simulator.
  • A device with a device name that is alphabetically later is preferred. For example, a device named "iphone 6" is preferred to a device named "iphone 5".

The following components are available for the connection string:

Component Description
deviceName The name of the mobile device. When testing on a physical mobile device, the device ID can be used instead. Supports wildcards. Case-insensitive.
platformName Android or iOS. Required.
deviceId Optional: The ID of the mobile device. Can be used instead of the device name, when testing on a physical mobile device. Supports wildcards. Case-insensitive.
platformVersion Optional: The Android or iOS version. Specify the version to test only on mobile devices that have a specific Android or iOS version. Supports wildcards. Case-insensitive.
browserVersion Optional: Can be used in combination with the browser type to test only on the specified browser version. Supports wildcards. Case-insensitive.
host Optional: If not set, any specified remote location can be used as the host. Supports wildcards. Case-insensitive.
app The full path to an app that is not installed on the mobile device yet. For example app=MyApp.apk.
  • appPackage
  • appActivity
To test an app that is already installed on an Android device, specify both the package of the app and the activity that you want to use. For example appPackage=silktest.insurancemobile;appActivity=.LoginActivity .
bundleId The identifier of the bundle of an app that is already installed on an iOS device. For example app=MyApp.ipa or bundleId=silktest.InsuranceMobile.
mobileCenterAppIdentifier The identifier of an app that is already installed on a mobile device that is managed by Mobile Center. For example mobileCenterAppIdentifier=com.microfocus.silktest.testapp.
mobileCenterAppUploadNumber The upload number of an app that is already installed on a mobile device that is managed by Mobile Center. Can be used to identify the application uniquely when the application is uploaded more than once. If this number is not specified, Silk Test Workbench uses the latest upload. For example mobileCenterAppUploadNumber=3.
noReset Optional: Can be set when testing native mobile applications. Is only valid if the app is specified. True if the app should not be reinstalled before testing. False if the app should be reinstalled before testing. The default value is False.
isSimulator Optional: Used to specify that the test should only be executed on an iOS Simulator. The device name can be used instead.
isPhysicalDevice Optional: Used to specify that the test should only be executed on a physical device. The device name can be used instead.

When using a pool of devices and to find out which device is actually used for testing, you can use the return value of the GenerateConnectionString method of MobileDevice class.

Testing a mobile web application on a mobile device or on an Android Emulator

When testing a mobile web application on a mobile device or on an Android Emulator, the connection string consists of the following parts:

  1. The mobile device name, for example MotoG3, or the device ID, for example 11111111.
    Note: If the device name is unique, Micro Focus recommends to use the device name in the connection string, because the device ID is less readable.
  2. The platform name.
  3. The browser version. This can only be used in combination with setting the browser type
  4. The IP address or the host name of a specific remote machine, for example 10.0.0.1. You can also use the name of a remote location that is specified in the Edit Remote Locations dialog box as the host name, for example MyRemoteLocation. When using the remote location name, you can also use wildcards. To test an Android device that is connected to the local machine, specify the IP address or the host name of the local machine.

Example: Connection string for any available Android device

"platformName=Android"

Example: Connection string for a browser on an Android device that is connected to the local machine

To test a mobile browser on an Android device that is connected to the local machine, the connection string should look similar to the following:
"deviceName=MotoG3;platformName=Android;host=localhost"
or
"platformName=Android;deviceId=11111111;host=localhost"

Example: Connection string for a browser on an Android device that is connected to a remote machine

To test a mobile browser on a remote Android device, the connection string should look similar to the following:
"deviceName=MotoG3;platformName=Android;host=10.0.0.1"
"deviceName=MotoG3;platformName=Android;host=MyRemoteLocation*"

Example: Connection string for an Android device that is managed by Mobile Center

If you want to replay tests from a CI server or tests from the command line on a device that is managed by Mobile Center, you can specify the connection string for the device instead of configuring the remote connection. The connection string should look like the following:
"deviceName=MotoG3;platformName=Android;host=http://<Mobile Center server>:8080;hostType=MC;userName=<Mobile Center user name>;password=<Mobile Center password>"
Note: For security reasons, Silk Test Workbench saves an encrypted form of the Mobile Center password when you create a new application configuration.Micro Focus recommends using the encrypted password in the connection string.

Example: Connection string for a browser on an iOS device that is connected to a Mac

To test a mobile browser on a remote iOS device, the connection string would look like the following:
"deviceName=myiPhone6;platformName=iOS;host=10.0.0.1"

Testing a native mobile application on a mobile device or on an Android Emulator

When testing a native mobile application on a mobile device or on an Android Emulator, the connection string consists of the following parts:
  1. The mobile device name, for example MotoG3, or the device ID, for example 11111111.
    Note: If the device name is unique, Micro Focus recommends to use the device name in the connection string, because the device ID is less readable.
  2. The platform name.
  3. The IP address or the host name of a specific remote machine, for example 10.0.0.1. You can also use the name of a remote location that is specified in the Edit Remote Locations dialog box as the host name, for example MyRemoteLocation. When using the remote location name, you can also use wildcards. To test an Android device that is connected to the local machine, specify the IP address or the host name of the local machine.
  4. The name of the file of the app that you want to test, or the URL of the file, if the file is located on a web server. For example C:/MyApp.apk or MyApp.ipa.
    • Android apps are always .apk files.
    • iOS apps on a real device are always .ipa files.
    • iOS apps on a Simulator are either a zipped file or a directory with the name app.

Example: Connection string for an app on an Android device that is connected to a remote machine

To test the app MyApp.apk on an Android device that is connected to a remote machine, the connection string would look like the following:
"platformName=Android;deviceName=MotoG3;host=http://10.0.0.1;app=MyApp.apk"

Example: Connection string for an app on an iOS device that is connected to a Mac

To test the app MyApp.ipa on an iOS device that is connected to a remote machine, the connection string would look like the following:
"platformName=iOS;deviceName=MyiPhone;host=http://10.0.0.1;app=MyApp.ipa"

Testing a mobile web application on an iOS Simulator

When testing a mobile web application on an iOS Simulator, the connection string consists of the following parts:
  1. The platform name, which is iOS.
  2. The platform version, for example 10.0.
  3. The mobile device name, for example iPhone6.
  4. The IP address or the host name of the Mac, on which the iOS Simulator is running.

Example: Connection string for a browser on an iOS Simulator on a Mac

"platformName=iOS;platformVersion=10.0;deviceName=iPhone6;host=10.0.0.1;isSimulator=true"

Testing a native mobile application on an iOS Simulator

When testing a native mobile application on an iOS Simulator on a Mac, the connection string consists of the following parts:
  1. The platform name, which is iOS.
  2. The platform version, for example 10.0.
  3. The mobile device name, for example iPhone6.
  4. The IP address or the host name of the remote machine, for example 10.0.0.1.
  5. The name of the app that you want to test, for example MyApp.ipa.

Example: Connection string for an app on an iOS Simulator on a Mac

"platformName=iOS;platformVersion=10.0;deviceName=iPhone6;host=10.0.0.1;app=MyApp.ipa;isSimulator=true"