The Ultimate Cheat Sheet on Step Generator in UFT

The Step Generator is a utility in UFT that could be utilized to add test steps in a Test without writing the code manually. UFT has added this utility on purpose so that you do not need to memorize syntax or to be proficient in high-level VBScript.If you are a new learner to UFT this utility could be very beneficial for you. You can use the Step Generator from the Keyword View and also from the Editor.

You can launch the Step Generator using any of the following ways

  • Go to the Design>Step Generator menu option. 
  • Press F7

The Step Generator will be launched.

Step Generator in UFT

The Step Generator utility provides options to define steps for the following three categories.


Adding Steps Using Test Objects Category in Step Generator

It is used to generate test steps using the test objects present in the Object Repository. Step Generator also gives you the option to select the object from the application if the same is not available in the object repository.


If the required Test Object is not available in the Object drop-down, click on the pointing hand icon as shown above. “Select Test Object” window will be displayed with the Object tree to let you select the required object. If the required object is not available in the object repository click on the cube icon button with a pointing hand to select an object from the application itself. Select the required object from the object tree and click on the “OK” button.Select-a-Test-object-uft

Now you have to select the operation you want to perform on the selected object. Click on the Operation drop-down, it will display a list of all the methods that can be performed on the object.


I have selected an object “userName” that is a WebEdit box. In order to show you an example, I have selected Set operation to set the text on it. After selecting the operation, you will see all the associated parameters with the method listed under the Arguments section.


You can add a constant value to the argument by clicking on the value column and manually set the value. The generated code is displayed under the Generated Step section.


Click on the “OK” button. The generated step will be added to the current action of the Test.

You can also parametrize the value rather than setting a constant value. Click on the <#> icon next to the value column or press Ctrl+F11. The Value Configuration Options window will be displayed. You can parametrize the constant value with either DataTable or Environment value.Step-Generator-UFT-6467808

To parameterize the value with DataTable, select the DataTable option, and enter the name of the parameter and click on the “OK” button.


The parameter name will be displayed in the value field.


If you want to wait for an object until it is displayed on the page, you can select WaitProperty as Operation and passed the values in the Value column. If you want to add more steps, check the “Insert another step” checkbox as shown above and click on the “OK” button. The generated step gets added to the script at the location where you had your cursor in the script before you opened the step generator.


If you select a method that has a return type, UFT automatically defines a variable where you want to store the output of the method as shown below. In the below example UFT will return either a True or  False value depending on the existence of the object on the page.tep-Generator-UFT-0244212

Adding Steps Using Utility Objects Category

This category can be used to generate steps for various utility objects as shown below.

Step Generator in UFT 0347598

Let’s say, we have added a parameter UserName in the global sheet of the DataTable and want to retrieve its value at runtime in UFT.


Select the DataTable object and provide the name of the ParameterID and SheetID as shown below.


Now you can use the returned variable var_Value to parametrize the username field value.

Adding Steps Using Functions Category

This category can be used to generate the steps for any of the methods we have defined in either function libraries or scripts or is in-build functions available in UFT.
I am using the DateAdd function from the inbuilt function in UFT to add one day on the required date.
I would recommend this, especially to novice users in the beginning phase of learning UFT to use it to generate steps without error if you get stuck anywhere while creating an automation test script.

Recommended Posts

Leave a Reply