Running mobile tests for Android 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 Android devices or emulators 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="<Android device or emulator 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 | <Android device or emulator name> | Specifies the name of the Android device or emulator 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 Android device or an emulator.
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="<Android device or emulator 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 | <Android device or emulator name> | Specifies the name of the Android device or emulator 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 | <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 BitBar Cloud
You can create an XML file as a variable file that specifies the details of the BitBar Cloud.
<?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"/>
<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 | <BitBar device name> | Specifies the name of the mobile device that is connected to
the BitBar cloud. Example:
|
bitbar.apikey | <BitBar API key> | Specifies the user token generated for your BitBar account to
authenticate your connection with the BitBar Cloud. Example:
|
bitbar.host | <BitBar host URL> | Specify the host name of the BitBar cloud
instance. Example:
|
bitbar.project | <project name> | Specifies the name of the project that contains the recorded
test. Example:
|
bitbar.testrun | <test name> | Specifies a name for the test run that must be displayed in
the BitBar dashboard for the test run. 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 Perfecto Mobile cloud
You can create an XML file as a variable file that specifies the details of the Perfecto Cloud.
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<Perfecto device name>" name="Mobile_Device_Selection"/>
<variable_init value="<security token>" name="perfecto.securitytoken"/>
<variable_init value="<perfecto host URL>" name="perfecto.host"/>
<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 | <Perfecto device name> | Specifies the name of the mobile device that is connected to
the Perfecto mobile cloud. Example:
|
perfecto.securitytoken | <security token> | Specifies the user token generated for your Perfecto account
to authenticate your connection with the Perfecto
cloud. Example:
|
perfecto.host | <perfecto host URL> | Specifies the URL of the Perfecto
Cloud.
|
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 pCloudy cloud
You can create an XML file as a variable file that specifies the details of the pCloudy cloud.
<?xml version="1.0" encoding="UTF-8"?>
<inits>
<variable_init value="<pCloudy 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"/>
<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 | <pCloudy device name> | Specifies the name of the mobile device that is connected to
the pCloudy cloud. Example:
|
pcloudy.apikey | <api key> | Specifies the user token generated for your Perfecto account
to authenticate your connection with the Perfecto
cloud. Example:
|
pcloudy.host | <pcloudy host URL> | Specifies the URL of the pCloudy Cloud instance. Example:
|
pcloudy.username | <pcloudy user name> | Specifies the user name of your pCloudy account. 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 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.