Parallel Execution with UFT

1
785
Parallel Execution in UFT

With version 14.03, UFT got capability to run parallel testing on mobile, which has been enhanced now with the latest version UFT 14.50, it extends the capability to run web tests parallelly. This again, is same as you might be using for mobile tests. Using CLI Tool – ParallelRunner, UFT Tests can run parallel on web browsers and mobile devices. In this post, we will look at the two methods to do parallel execution with UFT.

What is ParallelRunner?

ParallelRunner is a Command Line Interface (CLI) tool, which enables the capability to run tests in parallel. It means that you need to use or run this tool via command prompt.

A command-line interface or command language interpreter (CLI), also known as command-line user interface, console user interface[1] and character user interface (CUI), is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines). A program which handles the interface is called a command language interpreter or shell (computing).

— from Wikipedia

How to Run Tests in Parallel?

As mentioned above, you need to launch command prompt and go to the <UFT installation>/bin directory. ParallelRunner command can be executed in two ways

  1. Passing test and environment details as command line parameters
  2. Passing test and environment details within a .json file

Note that, ParallelRunner and UFT cannot run at the same. You must finish your scripting, save and close UFT before you start ParallelRunner.

Assumptions to proceed further

  1. You have your test script ready, which you need to execute. Note the location of your script, you will need to use that to pass as parameter
  2. You are using concurrent license. Seat license does not work, each test instance requires one concurrent license.

Passing test and environment details as command line parameters

This method is simple and easy to use when you have single test or configuration. You will need to run east test separately with individual commands

  • Launch Command Prompt
  • Change directory to UFT Installation bin folder if not already
  • Use command below to run your test

Command Line

You must have understood the parameters already, Just in case you need –

Parameter Type Required/Optional? Description
-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 To Run Test on Mobile Device

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

For example:

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

-b String Optional Define multiple browsers using semi-colons (;).

Supported values include:

  • Chrome
  • IE
  • IE64
  • Firefox
  • Firefox64

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.

-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.
-rr Integer 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.

 

Passing test and environment details within a .json file

In this method you need to define a json file in the command line as below

No worries, if you are not aware of .json file. JSON is short for JavaScript Object Notation, which gives us a collection of data in a much readable format. I personally take this in the same way we use object and properties. Refer the example below, piece of a .json file

When you need to access the data you use car.model, gives output as Mercedes. Know more about JSON at w3schools.

Lets create the .json file, In the .Json file you need to add separate lines for each test. First of all the report path should be specified where you need to save your run results. Use parameter “reportPath”

Define the path of your test using “test” parameter. To easily identify and distinguish between the run results, you must use “reportSuffix” parameter. You can choose to provide a significant relevant suffix to be added in your result file name.

Refer the table below for rest of the parameters to be used while creating the json file

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

Supported values include:

  • Chrome
  • IE
  • IE64
  • Firefox
  • Firefox64

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

For example – for a single test to run on Chrome

Below example for a test to run on Chrome and Mobile device

 

Once your json file is ready you can execute with ParallelRunner in the command prompt

Using JSON

To stop the execution use CTRL + C at the command prompt.

Some Limitations of ParallelRunner

  • Parallel Runner Supports running upto four tests in parallel. Which is good for the cases, where you need to run on multiple combination. It will need to wait till execution of your first four combinations are done
  • All Web 2.0 toolkits (ASP dot NET AJAX, Dojo, Ext-JS, GWT, jQueryUI, SiebelOpenUI, and YahooUI) are not supported when using ParallelRunner.
  • Below test objects and methods are not supported if used in your script
    • .Object method
    • WebFile objects
    • SystemUtil.Run method (recommended WebUtil.LaunchBrowser)
  • Run results can be viewed in IE versions 10 or higher

 

1 COMMENT

  1. […] Parallel test on mobile device was introduced in the previous version UFT 14.03. This has been enhanced further including the capability to execute web tests to run in parallel. Both Mobile and web parallel runs can be done via CLI tool ParallelRunner, which can be found in “bin” folder at UFT Installation folder. You will be able to trigger parallel test runs from Jenkins as well. Know more details here. […]

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.