官术网_书友最值得收藏!

Creating a DataTable parameter

DataTable is a UFT object that acts as a wrapper to an MS Excel file, and its scope is global. This means that it can be accessed from any action within a test, as well as from function libraries that were attached to the test. When you create a new test or open an existing UFT test, you will notice that the DataTable pane will always show a global and local datasheet, one for each existing action within the test. In this section, we will see how to create a DataTable parameter.

How to do it...

Perform the following steps to create the DataTable parameter LocalParam1 for the local sheet:

  1. From the File menu, navigate to New | Test or use the Ctrl + N shortcut. When a new test dialog opens, choose GUI Test and then click on the Create button.
  2. We will create a DataTable parameter in the Action1 local sheet from the UFT data pane by double-clicking on the column header and entering the parameter name LocalParam1 in the dialog that opens, as shown in the following screenshot:

    Similarly, for the test global sheet we will create a parameter named GlobalParam1.

  3. Next, we need to enter our input data in the remaining cells of the parameter column in the global or local sheet, according to the requirements.

How it works...

If we open the Default.xls file in the test folder (which, as its name suggests, is the default data source for a new test), we will notice that there are two worksheets, namely, Global and Action1. In each of these, the first row holds the name of the parameters, so we will see GlobalParam1 in the Global worksheet and LocalParam1 in the Action1 worksheet. You will also notice that the used rows have borders at the bottom of the worksheet (the borders have no real function; UFT identifies the used range by the number of used rows and columns based on the content range).

See also

For information about setting and retrieving values for a DataTable parameter, refer to the next two recipes, Retrieving data from a DataTable and Storing data in a DataTable.

主站蜘蛛池模板: 乃东县| 洪泽县| 陈巴尔虎旗| 昌乐县| 蒙阴县| 阿鲁科尔沁旗| 海盐县| 安平县| 东乡| 冕宁县| 宜黄县| 化隆| 光泽县| 正镶白旗| 天峨县| 静安区| 南雄市| 平山县| 荆门市| 肇东市| 田东县| 宾川县| 宿迁市| 郁南县| 丹棱县| 通渭县| 叶城县| 河北区| 外汇| 靖州| 阿克苏市| 巴林左旗| 赤壁市| 武定县| 绥江县| 吉木萨尔县| 上杭县| 乌兰察布市| 丹阳市| 东海县| 金溪县|