Run parallel web and mobile tests

Use the ParallelRunner CLI tool to run multiple UFT tests in parallel on mobile devices and web browsers.

Parallel web testing is supported on specific browsers, for controls supported by the Web Add-in. For the list of supported browsers, see the list of browser parameter values.

Before starting parallel testing

Before starting parallel testing, do the following:

Licenses

Ensure that your licenses support your use cases.

ParallelRunner supports running up to four tests in parallel. Additionally, desktop web testing in parallel requires a concurrent license server. Each web test run consumes a single concurrent license.

Mobile web testing

If you are testing mobile web browsers, ensure that the correct browser is selected in the Record and Run Settings, on the Mobile tab.

For more details, see Define settings to test mobile apps.

Back to top

Run tests in parallel

The ParallelRunner tool is located in the <UFT installation folder>/bin directory.

Do the following:

  1. Close UFT. ParallelRunner and UFT cannot run at the same time.

  2. Run your tests in parallel from the command line, defining your test and environment details using one of the following methods:

Tests run using ParallelRunner are run in Fast mode. For details, see Fast mode.

For more details, see:

Back to top

Define test and environments using command line parameters

When running tests from the command line, run each test separately with individual commands. Use the syntaxes defined below.

Tip: Alternately, reference a .json file with multiple tests configured. For details, see Define tests and environments using a .json file.

Web test command line syntax

From the command line, run each mobile test using the following syntax:

ParallelRunner -t <test path> -b <browser> -r <results path>

For example:

ParallelRunner -t "C:\GUIWebTest_Demo" -b "Chrome;IE;Firefox" -r "C:\parallelexecution"

Mobile test command line syntax

From the command line, run each mobile test using the following syntax:

ParallelRunner -t <test path> -d <device details> -r <results path>

For example:

ParallelRunner -t "C:\GUITest_Demo" -d "deviceID:HT69K0201987;manufacturer:samsung,osType:Android,osVersion:>6.0;manufacturer:motorola,model:Nexus 6" -r "C:\parallelexecution"

Command line parameters

Use the following parameters when running tests directly from the command line. Parameter names are not case sensitive.

-t

String. Required.

Defines the path to the folder containing the UFT test you want to run.

If your path contains spaces, you must surround the path with double quotes (""). For example: -t ".\GUITest Demo"

Multiple tests are not supported in the same path.

-d

String. Optional.

Define multiple devices using semi-colons (;).

Define devices using a specific device ID, or find devices by capabilities, using the following attributes in this string:

  • deviceID. Defines a device ID for a specific device in the Mobile Center device lab. This attribute cannot be used with other device capability attributes.

  • manufacturer. Defines a device manufacturer.

  • model. Defines a device model.

  • osType. Defines a device operating system.

    One of the following: Android, iOS, Windows Phone.

    If this value is not defined, UFT uses the osType defined in the test's Record and Run settings as a default.

  • osVersion. Defines a device operating system version. One of the following:

    • Any. Leaves the version number undefined.

    • A specific version. For example: 10.0

    • A boolean operator and version value. For example: >10.0, <10.0, >=10.0, or <=10.0

Note: Do not add extra spaces around the commas, colons, or semi-colons in this string. We recommend always surrounding the string in double quotes ("") to support any special characters.

For example:

–d "manufacturer:apple,osType:iOS,osVersion:>=11.0"

-b

String. Optional.

Define multiple browsers using semi-colons (;).

Supported values include:

  • Chrome
  • Chrome Headless (UFT versions 14.51 and higher)

  • Edge (UFT versions 14.51 and higher)
  • Firefox
  • Firefox64
  • IE
  • IE64
  • Safari (UFT versions 14.51 and higher)

Notes:

This value overrides any settings defined in the Record and Run Settings, and any browser parameterization configured in the test. The WebUtil.LaunchBrowser method is not affected.

Safari is supported via testing on a remote Mac machine. For more details, see Connect to a remote Mac computer.

-o

String. Optional.

Determines the result output shown in the console during and after the test run.

Supported values include:

  • Normal. (Default) Run output is automatically updated in the console.

    For example, the run status changes from Pending to Running, and then to Pass or Fail, and so on.

  • Static. The report path is displayed at the beginning of the test run, and then the run status is shown when the test is complete.

  • Disable. No output is shown in the console at all.

-r

String. Optional.

Defines the path where you want to save your test run results. By default, run results are saved at %Temp%\TempResults.

If your string contains spaces, you must surround the string with double quotes (""). For example: - r "%Temp%\Temp Results"

-rl

Optional.

Include in your command to automatically open the run results when the test run starts. Use the -rr parameter to determine how often it's refreshed.

For more details, see Sample ParallelRunner response and run results.

-rr

Optional.

Determines how often an open run results file is automatically refreshed, in seconds.

For example: -rr 5

Default, if no integer is presented: 5 seconds.

Back to top

Define tests and environments using a .json file

Run ParallelRunner by referencing a .json configuration file directly from the command line.

Do the following:

  1. Define the .json file in the command line using the following command line parameter:

    -c

    String. Defines the path to a .json configuration file.

  2. Add additional command line parameters to configure your run results. For details, see -rl and -rr.

    Note: If you use values defined in the command line in combination with values defined in a configuration file, values defined in the configuration file override the values defined in the command line.

  3. In your .json file, add separate lines for each test you want to run.

    Use the following syntax:

    ParallelRunner -c <.json file path>

    For example:

    ParallelRunner -c parallelexecution.json

Sample .json configuration file

The following is a sample .json configuration file syntax. In this file, the last test is run on both a local desktop browser and a mobile device.

{
 "reportPath": "C:\\parallelexecution",
 "parallelRuns": [
  {
   "test": "C:\\Users\\qtp\\Documents\\Unified Functional Testing",
   "reportSuffix": "Samsung_OS_above_6",
   "env": {
    "mobile": {
     "device": {
      "manufacturer": "samsung",
      "osVersion": ">6.0",
      "osType": "Android"
     }
    }
   }
  },
  {
   "test": "C:\\Users\\qtp\\Documents\\Unified Functional Testing",
   "reportSuffix": "Moto_Nexus_6_OS_equals_7",
   "env": {
    "mobile": {
     "device": {
      "manufacturer": "motorola",
      "model": "Nexus 6",
      "osVersion": "7.0",
      "osType": "Android"
     }
    }
   }
  },
  {
   "test": "C:\\Users\\qtp\\Documents\\Unified Functional Testing",
   "reportSuffix": "ID_HT69K0201987",
   "env": {
    "mobile": {
     "device": {
      "deviceID": "HT69K0201987"
     }
    }
   }
  },
  {
   "test": "C:\\Users\\qtp\\Documents\\Unified Functional Testing",
   "reportSuffix": "Web_Chrome",
   "env": {
    "web": {
     "browser": "Chrome"
    }
   }
  } ,
  {
   "test": "C:\\Users\\qtp\\Documents\\Unified Functional Testing",
   "reportSuffix": "Mobile_Web",
   "env": {
    "web": {
     "browser": "Chrome"
    },
    "mobile": {
     "device": {
      "manufacturer": "motorola",
      "model": "Nexus 6",
      "osVersion": "7.0",
      "osType": "Android"
     }
    }
   }
  }
 ]
}

Parameter reference for a .json configuration file

Define the following parameters in a .json configuration file to reference from the command line (case sensitive):

reportPath

String. Defines the path where you want to save your test run results.

By default, run results are saved at %Temp%\TempResults.

test

String. Defines the path to the folder containing the UFT test you want to run.

reportSuffix

String. Defines a suffix to append to the end of your run results filename.

Default: "[N]". This indicates the index number of the current result instance, if there are multiple results for the same test in the same parallel run.

browser

String. Defines the browser to use when running the test.

Supported values include:

  • Chrome
  • Chrome Headless (UFT versions 14.51 and higher)

  • Edge (UFT versions 14.51 and higher)
  • IE
  • IE64
  • Firefox
  • Firefox64
  • Safari (UFT versions 14.51 and higher)

Note: This value overrides any settings defined in the Record and Run Settings, and any browser parameterization configured in the test. The WebUtil.LaunchBrowser method is not affected.

deviceID

String. Defines a device ID for a specific device in the Mobile Center device lab.

Note: When both deviceID and device capability attributes are provided, the device capability attributes will be ignored.

manufacturer

String. Defines a device manufacturer.

model

String. Defines a device model.

osVersion

String. Defines a device operating system version.

One of the following:

  • Any. Leaves the version number undefined.

  • A specific version. For example 10.0

  • A boolean operator and version value. For example: >10.0, <10.0, >=10.0, or <=10.

osType

Defines a device operating system.

One of the following:

  • Android
  • iOS
  • Windows Phone

Back to top

Run steps in isolated mode

Supported in UFT versions 14.51 and higher.

When running multiple tests in parallel that have related steps that interact with the same objects, the steps may interfere with each other and cause errors in your parallel test run.

To prevent errors, configure those steps to run in isolated mode, protected from interference from other tests running in parallel.

Surround the steps you want to run in parallel with the following utility steps:

  • ParallelUtil.StartIsolatedExecution
  • ParallelUtil.StopIsolatedExecution

For example:

ParallelUtil.StartIsolatedExecution

Browser("Advantage Shopping").Page("Google").WebEdit("Search").Click

Dim mySendKeys

set mySendKeys = CreateObject("WScript.shell")

mySendKeys.SendKeys("Values")

ParallelUtil.StopIsolatedExecution

For more details, see the ParallelUtil object reference in the UFT Object Model Reference.

Back to top

Stop the parallel execution

To quit the test runs from the command line, press CTRL+C on the keyboard.

  • Any test with a status of Running or Pending, indicating that it has not yet finished, will stop immediately.
  • No run results are generated for these canceled tests.

Back to top

Sample ParallelRunner response and run results

The following code shows a sample response displayed in the command line after running tests using ParallelRunner.

>ParallelRunner -t ".\GUITest_Demo" -d "manufacturer:samsung,osType:Android,osVersion:Any;deviceID:N2F4C15923006550" -r "C:\parallelexecution"

Report Folder: C:\parallelexecution\Res1

ProcessId, Test, Report, Status

3328, GUITest_Demo, GUITest_Demo_[1], Running -

3348, GUITest_Demo, GUITest_Demo_[2], Pass

In this example, when the run is complete, the following result files are saved in the C:\parallelexecution\Res1 directory:

  • GUITest_Demo_[1]
  • GUITest_Demo_[2]

The parallelrun_results.html file shows results for all tests run in parallel. The first row in the table indicates any rules defined by the ParallelRunner commands, and subsequent rows indicate the result and the actual environment used during the test.

Tip: For each test run, click the HTML report icon to open the specific run results. This is supported only when UFT is configured to generate HTML run results.

For example:

Back to top

Modify the ParallelRunner port

ParallelRunner uses the port configured in the parallel.ini file located in the <UFT installation folder>/bin> directory. The default port is 50051.

If the port configured there is already in use elsewhere, modify it by doing one of the following:

  • Open the <UFT installation folder>/bin/parallel.ini file for editing, and modify the port number configured.

  • If you have permission issues editing this file, create a new file named parallel.custom.ini in the %ProgramData%\UFT directory.

    Add the following code:

    [Mediator]
    Port=<port number>

    The parallel.custom.ini file overrides any configuration in the parallel.ini file.

Back to top

See also: