Set Desired Capabilities

Desired Capabilities allow you to indicate important parameters. These parameters tell the Appium Server how you want your test sessions to behave. When you connect a mobile device, emulator, or simulator to your workstation, Tricentis Tosca uses a default collection of Desired Capabilities to communicate with the Appium Server.

If you need to use custom Desired Capabilities, you can specify them when you scan your mobile application with the Mobile Scan and when you execute your TestCases. This chapter describes how to:

For a list of all supported Desired Capabilities, see the Appium Documentation and WebDriverAgent Documentation.

Set Desired Capabilities for a scan

You can set Desired Capabilities to specify connection parameters during the scan of a mobile device, emulator, or simulator.

To do so, follow the steps below:

  1. Create a .conf file in the default directory %TRICENTIS_ALLUSERS_APPDATA%\Automation\Mobile30\Configuration.

    Alternatively, you can create the .conf file in a different directory. In this case, you need to specify the file path in Tosca Commander under Project->Settings->TBox->Engines->Mobile30->Desired capabilities path.

  2. Structure the information in the .conf file as shown in the code sample below:

    • Keys on the left side, followed by a comma.

    • Required values after the comma.

useNewWDA,false

usePrebuiltWDA,true

wdaLocalPort,8102

newCommandTimeout,80

orientation,LANDSCAPE

autoWebview,true

If you want to scan a mobile application in Perfecto Mobile, create a similar .conf file, using keys and values that correspond to:

  1. Scan your mobile device with the Mobile Scan (see chapter "Start the Mobile Scan and connect").

  2. In the Mobile Scan window, click Advanced Configuration.

Advanced configuration button in the Mobile Scan window

  1. On the left side of the Advanced Configuration window, select your .conf file with Desired Capabilities. On the right side, you can see a preview of the .conf file you use.

    If you want to edit the Desired Capabilities, you have to update the keys and values directly in the .conf file.

Preview of a .conf file in the Advanced configuration window

  1. Click Add and continue the scan from point 6 as described in chapter "Start the Mobile Scan and connect".

Set Desired Capabilities for test execution

You can also apply Desired Capabilities to your test execution.

Use the Set Desired Capabilities Module to define which Desired Capabilities you want to use.

This Module is part of the Standard subset. You can find it under Standard modules->TBox XEngines->Mobile.

To apply Desired Capabilities to your test execution, follow the steps below:

  1. Specify the test configuration parameters to establish a connection with the device.

  2. Drag and drop the Set Desired Capabilities Module onto your TestCase. It must be the first TestStep of your TestCase.

  3. Enter the name of a Desired Capability into the Name column.

  4. Enter the required value of the Desired Capability into the Value Column.

  5. Set the ActionMode to Select.

  6. Add either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep in the execution.

In this example, you apply the Desired Capabilities skipServerInstallation and skipDeviceInitialization to reduce the startup time of Android test execution.

Set Desired Capabilities Module in a TestCase

Use Desired Capabilities to reduce startup time

You can use Desired Capabilities to reduce the startup time of the Appium Server. The table below lists the Desired Capabilities that you can apply for a scan or for test execution on Android or iOS devices.

Desired Capability

Android

iOS

Description

noSign

Responsible for checking and signing the app with debug keys.

The default value is False.

Set this Desired Capability to True to reduce startup time. Use it only with UiAutomator.

skipDeviceInitialization

Skips device initialization that includes, for example, installation and running the settings app or permission settings.

The default value is False.

If you have already used the mobile device for test automation and it is prepared for the next automation, set this Desired Capability to True to improve startup performance.

Use this Desired Capability from Appium version 1.12.0.

skipServerInstallation

Skips the installation of UiAutomator2 and uses uiAutomator2 from the device.

The default value is False.

Set this Desired Capability to True to reduce startup time when an UiAutomator2 server in proper version (i.e. a version compatible with the installed Appium Server) is already installed on your device.

Use this Desired Capability from Appium version 1.12.0.

skipUnlock

Skips unlocking of the mobile screen.

The default value is False.

If you are sure that the screen of the mobile device is unlocked, you can set this Desired Capability to True to reduce the Appium startup time.

useNewWDA

Uninstalls an existing WebDriverAgent app from the device. If set to True, this Desired Capability enables you to apply different WebDriverAgent startup options at the beginning of each session.

The default value is True.

Set this Desired Capability to False to reduce startup time.

usePrebuiltWDA

Skips building the WebDriverAgent app when running the application. If enabled, you must build the app yourself. This Desired Capability works only with Xcode 8 or later.

The default value is False.

Set this Desired Capability to True to reduce startup time.

For a list of all supported Desired Capabilities, see the Appium Documentation and WebDriverAgent Documentation.