Running Web UI tests from the command-line

You can run a Web UI test without using the desktop client by using the command-line interface. You must use the -varfile parameter that specifies the complete path to the XML file in the command. The XML file contains the name-value pairs of the variables. The variables file specifies the web browser on a computer, device, emulator, or device on a cloud on which to run the test.

Running the command

Before you can run the command to run Web UI tests from the command line, you must create a variable file that contains the details of the computer, device, emulator, or device on a cloud on which you want to specify the web browser to run the test. You must have also recorded the Web UI test.

You can issue the following command to run a Web UI test from the command-line:

cmdline -workspace <workspace_full_path> -project <proj_relative_path> -eclipsehome <eclipse_full_path> -plugins <plugin_full_path> -suite <suite_relative_path> -importzip <full_path.zip> -varfile <variable_file_full_path> -configfile <file_full_path> -results <result_file> -overwrite <{"true" | "false"}> -quiet -vmargs <JVM_args> -publish <serverURL#project.name=projectName -publish_for {ALL,PASS,FAIL,ERROR, INCONCLUSIVE}> -labels <labelname1, labelname2> -exportlog <log_full_path> -exportstats <local_dir_path> -exportstatshtml <local_dir_path> -exportstatsformat <name of the file format> -compare <"result_path1, result_path2"> -exportstatreportlist <stats_list> -execsummary <local_dir_path> -execsummaryreport <reportID> -usercomments <"any user comment"> -publishreports <"FT, STATS, TESTLOG"> -stdout -swapdatsets <existing_dataset_file_path:new_dataset_file-path>

Important: When you use the command to run a Web UI test, you must ensure that the following conditions are satisfied:
  • Use the variable file that contains the details of the computer, device, emulator, or device on a cloud on which you want to select the web browser.
  • Specify the details of the variable file in the command.

Creating a variable file

You must create a variable file that contains the variable names and values as pairs that are required to connect to the web browser. You can connect and run the Web UI tests on browsers on any of the following computers, devices, emulators, or devices on a cloud:

Variable file for a computer on which you have installed Test UI

You can create an XML file as a variable file that specifies the browser to use on the computer on which you have installed . The format of the variable file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<browser>" name="RTW_WebUI_Browser_Selection"/>
</inits>
For example, if you connect Emulator:Pixel_2_API_28 as the mobile emulator and you want to use the Chrome browser to run the test, the variable file can be as follows:
<?xml version="1.0" encoding="UTF-8"?><inits>
<variable_init value="Chrome(Emulator:Pixel_2_API_28)" name="RTW_WebUI_Browser_Selection"/>
</inits>

Variable file for UI Test Agent

You can create an XML file as a variable file that specifies the browser to use on a device or an emulator connected to the remote computer. The format of the variable file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<browser(device or emulator name)>" name="RTW_WebUI_Browser_Selection"/>             
<variable_init value="<UI Test Agent host URL>" name="appium.server.host"/>
<variable_init value="<port number>" name="appium.server.port"/>
</inits>

The following table lists the variables and the actions required for the value field:

Variable Action
RTW_WebUI_Browser_Selection Specify the browser to be used on the device or emulator that is connected to the UI Test Agent on the remote computer.
appium.server.host Specify the host name or IP address of the remote computer that contains the UI Test Agent.
Note: The default value for this variable is 127.0.0.1. If no value is specified, the default value is used during the playback.
appium.server.port Specify the port number of the UI Test Agent that is installed on the remote computer.
For example, if you connect Emulator:Pixel_2_API_28 as the mobile emulator to a remote computer where the UI Test Agent URL is 10.115.50.61, and the UI Test Agent port is 7082, and you want to use the Chrome browser, the variable file can be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="Chrome(Emulator:Pixel_API_28)" name="RTW_WebUI_Browser_Selection"/>             
<variable_init value="10.115.50.61" name="appium.server.host"/>
<variable_init value="7082" name="appium.server.port"/>
</inits>

Variable file for BitBar Cloud

You can create an XML file as a variable file that specifies the browser to be used on the device on the BitBar Cloud. The format of the variable file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<Browser(BitBar device name)>" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="<BitBar API key>" name="bitbar.apikey"/>
<variable_init value="<BitBar host URL>" name="bitbar.host"/>
<variable_init value="<project name>" name="bitbar.project"/>
<variable_init value="<test name>" name="bitbar.testrun"/>
</inits>
The following table lists the variables and the sample values:
Variable Action Sample value
RTW_WebUI_Browser_Selection Specify the browser to be used on the mobile device that is connected to the BitBar Cloud. Chrome(BitBar:Google Pixel 2)
bitbar.apikey Specify the user token generated for your BitBar account to authenticate your connection with the BitBar Cloud. LkBldnjcnzrIcwWZpCZZxy
bitbar.host Specify the host name of the BitBar Cloud instance. appium.bitbar.com
bitbar.project Specify the name of the project that contains the recorded test. PlaybackWebUI
bitbar.testrun Specify a name for the test run that must be displayed in the BitBar dashboard for the test run. CLIExecution

The example variable file for the values in the table is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="Chrome(BitBar:Google Pixel 2)" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="LkBldnjcnzrIcwWZpCZZxy" name="bitbar.apikey"/>
<variable_init value="appium.bitbar.com" name="bitbar.host"/>
<variable_init value="PlaybackWebUI" name="bitbar.project"/>
<variable_init value="CLIExecution" name="bitbar.testrun"/>
</inits>

Variable file for BrowserStack Cloud

You can create an XML file as a variable file that specifies the browser to be used on the device on the BrowserStack Cloud. The format of the variable file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<BrowserStack user name>" name="browserstack.username"/>
<variable_init value="<BrowserStack host URL>" name="browserstack.host"/>
<variable_init value="<BrowserStack API key>" name="browserstack.apikey"/>
<variable_init value="<project name>" name="browserstack.project"/>
<variable_init value="<Browser(BrowserStack : device name)>" name="RTW_WebUI_Browser_Selection"/>
</inits>
The following table lists the variables and the sample values:
Variable Action Sample value
browserstack.username Specify the user name of your BrowserStack account to authenticate your connection with the BrowserStack Cloud. tester_1
browserstack.host Specify the host name of the BrowserStack Cloud instance. api-cloud.browserstack.com
browserstack.apikey Specify the user token generated for your BrowserStack account to authenticate your connection with the BrowserStack Cloud. KBk7PjhpqgfeVmxasUye
browserstack.project Specify the name of the project that contains the recorded test. CMDLINETest
RTW_WebUI_Browser_Selection Specify the browser to be used on the mobile device that is connected to the BrowserStack Cloud. Chrome(BrowserStack : Google Pixel 7 Pro)

The example variable file for the values in the table is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="tester_1" name="browserstack.username"/>
<variable_init value="api-cloud.browserstack.com" name="browserstack.host"/>
<variable_init value="KBk7PjhpqgfeVmxasUye" name="browserstack.apikey"/>
<variable_init value="CMDLINETest" name="browserstack.project"/>
<variable_init value="Chrome(BrowserStack : Google Pixel 7 Pro)" name="RTW_WebUI_Browser_Selection"/>
</inits>
If you want to run a compound test that contains a Web UI test and a mobile test, then you can specify the device and browser by using Mobile_Device_Selection and RTW_WebUI_Browser_Selection. For example,

<variable_init value="BrowserStack : Google Pixel 7 Pro" name="Mobile_Device_Selection"/>
<variable_init value="Chrome(BrowserStack : Google Pixel 7 Pro)" name="RTW_WebUI_Browser_Selection"/>

Variable file for Perfecto Cloud

You can create an XML file as a variable file that specifies the browser to be used on the device on the Perfecto Mobile Cloud. The format of the variable file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<browser(device name)>" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="<security token>" name="perfecto.securitytoken"/>
<variable_init value="<perfecto host URL>" name="perfecto.host"/>
</inits>
The following table lists the variables and the sample values:
Variable Action Sample value
RTW_WebUI_Browser_Selection Specify the browser to be used on the mobile device that is connected to the Perfecto Cloud. Chrome(Perfecto:R48904TNSAZ)
perfecto.securitytoken Specify the user token generated for your Perfecto account to authenticate your connection with the Perfecto Cloud. LkBldnjcnzrIcwWZpCZZxy
perfecto.host Specify the URL of the Perfecto Cloud. partners.perfectomobile.com

The example variable file for the values in the table is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="Chrome(Perfecto:R48904TNSAZ)" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="LkBldnjcnzrIcwWZpCZZxy" name="perfecto.securitytoken"/>
<variable_init value="partners.perfectomobile.com" name="perfecto.host"/>
</inits>

Variable file for pCloudy Cloud

You can create an XML file as a variable file that specifies the browser on the device connected to the pCloudy Cloud. The format of the variable file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<browser(device name)>" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="<api key>" name="pcloudy.apikey"/>
<variable_init value="<pcloudy host URL>" name=" pcloudy.host"/>
<variable_init value="<pcloudy user name>" name="pcloudy.username"/>
</inits>
The following table lists the variables and the sample values:
Variable Action Sample value
RTW_WebUI_Browser_Selection Specify the browser to be used on the device that is connected to the pCloudy Cloud. Chrome(pCloudy:SAMSUNG_GalaxyS8_Android_7.0.0_3ced4)
pcloudy.apikey Specify the API key of your pCloudy account to authenticate the user name for a successful connection. csv7wxjyyzzgrzbqym62cvfg
pcloudy.host Specify the URL of the pCloudy Cloud instance. device.pcloudy.com
pcloudy.username Specify the user name of your pCloudy account. myUserName@pcloudy

The example variable file for the values in the table is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="Chrome(pCloudy:SAMSUNG_GalaxyS8_Android_7.0.0_3ced4)" name="RTW_WebUI_Browser_Selection"/>
<variable_init value="csv7wxjyyzzgrzbqym62cvfg" name="pcloudy.apikey"/>
<variable_init value="device.pcloudy.com" name="pcloudy.host"/>
<variable_init value="myUserName@pcloudy" name="pcloudy.username"/>
</inits>