UFT Parameterization using Data Table
UFT Basics

UFT Classes #13: Parameterization using Data Table | After all the scripts need ‘Test Data’

Now that you know about the concept of UFT Actions, Object Repository and Functions let’s understand how to input Test Data to UFT scripts or parameterization using a Data Table.

Say you are testing a payment initiation form. One of the most important prerequisite is to have relevant Test Data in place, i.e. the values you are going to fill in the form attributes. Now think of it from UFT Automation perspective. What are the options? Hard-coding these Test data values in your automation script is one of them. But what if you need different sets of data for each run of the test case? Yeah! There is no sense in updating the code for each & every run. Then how do you achieve automation? Or how do you tell UFT which Test data to use for Test runs?

Parameterization via Data Table

Parameterization is nothing but telling UFT to how & from where to fetch the Test Data for running the Test cases. One of the simplest method for parameterization is using the “Data Tables”! Data Table is just like Microsoft Excel file, viewable in UFT. Parameterize your test so that it run ten times, each time using a different set of data (row by row). Each iteration should begin with the AUT being the same state and ending in the same state. Always try to return your application to the state where it began.

We have two types of Data Tables:

  • Global: available to all actions in the test
  • Local: available to the corresponding action

To execute a particular test case for specified number of iterations, one can set the iterations of global data table in the Test Settings dialog, that can be accessed using File >> Settings >> Run (Tab)


Data Table Object Model

This means that in UFT – Data Table is also an Object, i.e. it also has associated properties and methods. Similarly DTSheet and DTParameter are also Objects.

Import and Export Excel Sheet into Data Table

  1. Import(FileName)

DataTable.Import(“C:UsersDeepanshuDocumentsProject_WorkHP ProjectAutomation WorkHP TestAutomationData FilesSupportUFT_Page.xls”)

  1. Export(FileName)

DataTable.Export(“C:Run-Time DataTable.xls”) >> Export run-time data table in “Run-Time DataTable.xls”

Read Data from Data Table

From Global Data Table

  • Value(“ColumnName”, dtGlobalSheet)
  • Value(“ColumnName “, 1)
  • Value(“ColumnName “, Global)

From Local Data Table

  • Value(“ColumnName “, dtLocalSheet)
  • Value(“ColumnName “, 2)
  • Value(“ColumnName “, “Action1”)

Types of Data Table

  • Design Time: While scripting in UFT, you enter test data directly in the data table displayed in UFT (View >> Data Table).
  • Run-time: Used while running the test. It can be same as design time table and/or can be entered by importing data from excel sheet, text file etc. It may contain values that are changed during script execution and can be seen in the ‘Test Results’ window when run session ends. The changes made to the data during the run-time are not saved to design time data table. Data like parameterized output, checkpoint values, and output values are stored in the Run-time Table. It is an .xls file which is stored in the Test Results Folder.  It can also be accessed in the Test Fusion Report.




Leave a Reply

Your email address will not be published. Required fields are marked *