Running mobile tests for iOS applications from the command-line
Running the command
Before you can run the command to run mobile tests from the command line, you must create a variable file that contains the details of the computer to which the mobile device is connected. You must have also recorded the mobile test.
You can issue the following command to run a mobile 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>
- Use the variable file that contains the details of the computer, server, or cloud to which the iOS devices or simulators are connected.
- Specify the details of the variable file in the command.
Creating a variable file
Variable file for a computer on which you have installed HCL OneTest™ UI
You can create a variable file in XML format to specify the details required to run the mobile test on selected device.
You can also add the details to enable the HCL OneTest™ UI to collect metrics for certain parameters of the resources used by the mobile devices.
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<iOS device name>" name="Mobile_Device_Selection"/>
<variable_init value="true" name="rm.selected"/>
<variable_init value ="any value equal to or above 1000" name="rm.polling.interval"/>
</inits>
Attribute | Variable | Description |
---|---|---|
Mobile_Device_Selection | <ios device or Simulator name> | Specifies the name of the iOS device or simulator that is
connected to the computer. Example:
|
rm.selected | <true> |
Optional. If you want to collect the
metrics for certain parameters of resources used by mobile
applications or devices, set the value to
true. Collection of Resource
Monitoring metrics and displaying of the data graphically is
supported only when you run a single test on a single
device. For example, the entry in the
XML file can be as follows:
|
rm.polling.interval | <any value equal to or above 1000> |
Specifies the interval in milliseconds
to collect the metrics for certain parameters of resources
used by mobile application or device. The minimum value that
you can enter is 1000 milliseconds. Enter the value, if you
set the attribute rm.selected to
true. For example, the entry in the
XML file can be as follows:
|
You can then use the variable file with the -varfile option in the command to run a test from the command line.
Variable file for UI Test Agent
You can create an XML file as a variable file that specifies the details of the remote computer on which you have installed the UI Test Agent and connected the iOS device or a simulator.
You can also add the details to enable the HCL OneTest™ UI to collect metrics for certain parameters of the resources used by the mobile devices.
A sample of the syntax or structure is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<iOS device or simulator name>" name="Mobile_Device_Selection"/>
<variable_init value="<UI Test Agent host URL>" name="appium.server.host"/>
<variable_init value="<port number>" name="appium.server.port"/>
<variable_init value="true" name="rm.selected"/>
<variable_init value ="any value equal to or above 1000" name="rm.polling.interval"/>
</inits>
Attribute | Variable | Description |
---|---|---|
Mobile_Device_Selection | <iOS device or a simulator name> | Specifies the name of the iOS device or a simulator that is
connected to the computer. Example:
|
appium.server.host | <UI Test Agent host URL> | Specifies the host name or IP address of the remote computer
on which you have installed 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. Example:
|
appium.server.port | <port number> | Specifies the port number of the UI Test Agent that is
installed on the remote
machine.
|
rm.selected | <true> |
Optional. If you want to collect the
metrics for certain parameters of resources used by mobile
applications or devices, set the value to
true. Collection of Resource
Monitoring metrics and displaying of the data graphically is
supported only when you run a single test on a single
device. For example, the entry in the
XML file can be as follows:
|
rm.polling.interval | <value equal to or above 1000> |
Specifies the interval in milliseconds
to collect the metrics for certain parameters of resources
used by mobile application or device. The minimum value that
you can enter is 1000 milliseconds. Enter the value, if you
set the attribute rm.selected to
true. For example, the entry in the
XML file can be as follows:
|
You can then use the variable file with the -varfile option in the command to run a test from the command line.
Variable file for BitBar Cloud
Create an XML file as a variable file that specifies the details of the BitBar Cloud. The format of the variable file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<BitBar device name>" name="Mobile_Device_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>
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | Specify the name of the mobile device that is connected to the BitBar cloud. |
bitbar.apikey | Specify the user token generated for your BitBar account to authenticate your connection with the BitBar Cloud. |
bitbar.host | Specify the host name of the BitBar cloud instance. |
bitbar.project | Specify the name of the project that contains the recorded test. |
bitbar.testrun | Specify a name for the test run that must be displayed in the BitBar dashboard for the test run. |
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | BitBar:iPhone 11 Pro_14.0 |
bitbar.apikey | LkBldnjcnzrIcwWZpCZZxy |
bitbar.host | appium.bitbar.com |
bitbar.project | PlaybackMobile |
bitbar.testrun | 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="BitBar:iPhone 11 Pro_14.0" name="Mobile_Device_Selection"/>
<variable_init value="LkBldnjcnzrIcwWZpCZZxy" name="bitbar.apikey"/>
<variable_init value="appium.bitbar.com" name="bitbar.host"/>
<variable_init value="PlaybackMobile" name="bitbar.project"/>
<variable_init value="CLIExecution" name="bitbar.testrun"/>
</inits>
You can then use the variable file with the -varfile option in the command to run a test from the command line.
Variable file for Perfecto Mobile cloud
Create an XML file as a variable file that specifies the details of the Perfecto Mobile cloud. The format of the variable file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<device name>" name="Mobile_Device_Selection"/>
<variable_init value="<security token>" name="perfecto.securitytoken"/>
<variable_init value="<perfecto host URL>" name="perfecto.host"/>
</inits>
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | Specify the name of the mobile device that is connected to the Perfecto mobile cloud. |
perfecto.securitytoken | Specify the user token generated for your Perfecto account to authenticate your connection with the Perfecto Mobile cloud. |
perfecto.host | Specify the URL of the Perfecto mobile cloud that is configured to communicate with HCL OneTest™ UI. |
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | Perfecto:8D3E35CF16D8D827E4827ABBCD0E582E2761CADA |
perfecto.securitytoken | LkBldnjcnzrIcwWZpCZZxy |
perfecto.host | 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="Perfecto:8D3E35CF16D8D827E4827ABBCD0E582E2761CADA" name="Mobile_Device_Selection"/>
<variable_init value="LkBldnjcnzrIcwWZpCZZxy" name="perfecto.securitytoken"/>
<variable_init value="partners.perfectomobile.com" name="perfecto.host"/>
</inits>
You can then use the variable file with the -varfile option in the command to run a test from the command line.
Variable file for pCloudy cloud
Create an XML file as a variable file that specifies the details of the pCloudy cloud. The format of the variable file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<device name>" name="Mobile_Device_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>
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | Specify the name of the mobile device that is connected to the pCloudy cloud. |
pcloudy.apikey | Specify the API key of your pCloudy account to authenticate the user name for a successful connection. |
pcloudy.host | Specify the URL of the pCloudy cloud instance. |
pcloudy.username | Specify the user name of your pCloudy account. |
Name of the Variable | Value |
---|---|
Mobile_Device_Selection | pCloudy:Apple_iPhone8plus_Ios_14.4.0_9db66 |
pcloudy.apikey | csv7wxjyyzzgrzbqym62cvfg |
pcloudy.host | poc.pcloudy.com |
pcloudy.username | 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="pCloudy:Apple_iPhone8plus_Ios_14.4.0_9db66" name="Mobile_Device_Selection"/>
<variable_init value="csv7wxjyyzzgrzbqym62cvfg" name="pcloudy.apikey"/>
<variable_init value="poc.pcloudy.com" name="pcloudy.host"/>
<variable_init value="myUserName@pcloudy" name="pcloudy.username"/>
</inits>
You can then use the variable file with the -varfile option in the command to run a test from the command line.
Variable file to run mobile tests on multiple mobile clouds
When you want to run mobile tests on devices that are connected to multiple mobile clouds, you can create an XML file and use it as a variable file. You must specify the details of each of the mobile clouds in the variable file that enable HCL OneTest™ UI to connect to the mobile clouds.
You can configure details of the mobile clouds as an xml file. You can use the following sample XML file to enter the details of the name and value pairs for the mobile clouds.
For example, if you want to run on the BitBar Cloud and pCloudy Cloud, edit the XML file and remove the details of the Perfecto Cloud.
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<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"/>
<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"/>
<variable_init value="<security token>" name="perfecto.securitytoken"/>
<variable_init value="<perfecto host URL>" name="perfecto.host"/>
</inits>
Refer to the following table to know the details of the mobile clouds, that you need to enter in the XML file:
Mobile clouds | Name of the variable | Value of the variable |
---|---|---|
BitBar Cloud | bitbar.apikey | Specifies the user token generated for your BitBar account to authenticate the connection with the BitBar Cloud. |
bitbar.host | Specifies the host name of the BitBar Cloud instance. | |
bitbar.project | Specifies the name of the project that contains the recorded test. | |
bitbar.testrun | Specifies a name for the test run that must be displayed in the BitBar dashboard for the test run. | |
pCloudy Cloud | pcloudy.apikey | Specifies the API key of your pCloudy account to authenticate the user name for a successful connection. |
pcloudy.host | Specifies the URL of the pCloudy cloud instance. | |
pcloudy.username | Specifies the user name of your pCloudy account. | |
Perfecto Cloud | perfecto.securitytoken | Specifies the user token generated for your Perfecto account to authenticate your connection with the Perfecto Cloud. |
perfecto.host | Specifies the URL of the Perfecto Cloud. |
You can then use the variable file with the -varfile option in the command to run a test from the command line.