WinRunner: Parameterization rules:

WinRunner: Parameterization rules:

> Do not call the excel sheet default.xls, rename it the same name as your script (or calling script).

If you want the change the start row of the table change the code table_Row = 1 on the line

for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)

> The c:~WinRunnerdatddt_func.ini file lists what functions will work with Data Driven testing. No web functions are listed in this file. If you want to data drive a web function you will have to added them to the file.

> Any Excel file used for data driven testing must be saved in excel format.

> The Excel Files can only have one worksheet and no formatting.

> The character length max for a number in a cell is 10 char. Anything over becomes scientific notation and does not work. There are two workarounds to this problem, option one is to use concatenation, and option two is to use a \' in the field and make the value a string.

Workaround 1:

Use the & (concatenation command to make your values larger. ) Here is a code sample: edit_set(\"1\" & ddt_val(table,\"SalesNumMax\"));

Workaround 2:

In the data table, instead of typing in the number as 12345678901 type it in as \'12345678901. The \' in the front of the number will make it a string (and strings char limits are 255).

> Also a field length can not start with leading 0\'s. To work around this, use either of the methodologies shown above.

> When defining a new table in the DataDriver Wizard, the table will not be saved if an .xls extension is not specified.

Workaround: When typing the name of a new table, set the name to have an .xls extension. If you use the Parameterize Data function, DO NOT highlight the row, just put your cursor on the space you want to over lay and it will work. If you highlight the whole row, it comes back all messed up.

Here are some steps that explain how to use the DataDriven functionality in WinRunner.

1. Record your script save it

2. Select wizard Tools -> Data Driven Wizard

3. Press Next button

4. At Use a new or existing Excel file box: Navigate to data file area and select data file or enter name for new file.

5. On Assign table name variable: Enter the name to call table in script.

6. Check off Add statements and create a data-driven test

7. Check Parameterize test by line

8. Press Next button

9. On Test Script line to parameterize: either do not replace line (if you don\'t want to) or select a new column. If you select a new column (you can change column name if you want.

10. Repeat for all lines that appear (this depends upon how many line you have in script.

11. When done press Finish

12. Your script will come back and it is all parameterized for you.

Here are Code:

1 table = \"path to excel file\";

2 rc = ddt_open(table, DDT_MODE_READ);

3 if (rc!= E_OK && rc != E_FILE_OPEN)

4 pause(\"Cannot open table.\");

5 ddt_get_row_count(table,table_RowCount);

6 for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)

7 {

8 ddt_set_row(table,table_Row);

9 edit_set(\"Log\",ddt_val(table,\"Log\"));

10 obj_type(\"Log\",\"\");

11 edit_set(\"password\",ddt_val(table, \"password\"));

12 button_press(\"Login\");

13 }

14 ddt_close(table);


1. Create an xls file (using WinRunner\'s Tools -> Data Table)

2. Make the Columns names be your variable name, make the rows be your data.

3. Save the Xls file

4. At the top of your script type line 1 (take from above example) - This sets the table name for you.

5. Type lines 2 - 5 exactly - this tells the script to open the table and does error handling incase it can\'t open the table, and gets the count of the table

6. Now move cursor to area want to parameterize.

7 Type lines 6 - 8. If you do not want to script to start on row 1, change table_Row = (row to start on).

If you want to run numerous times then create a loop here.

8. Now move cursor to line you want to parameterize. You parameterize by replacing the value in the edit_field statement with ddt_val(table, \"variable\").


edit_set(\"log\", \"STORE\");

After parameterization will look like:

edit_set(\"Log\", ddt_val(table,\"Log\"));

9. Repeat for all lines you want to parameterize.

10. Then add the closing }.

11. Add the last line (14) to close the table.

12. Repeat steps 7 - 11 for all areas you need to parameterize in code.

ddt_func.ini file:

The Data Wizard functionality uses the ddt_func.ini file to determine which functions you can parameterize. If you run the wizard and find that a certain function does not parameterize the work around is to add the parameter to the ddt_func.ini file. Here are the steps :

 1. Shut down WinRunner Application 

2. Open the ddt_func.ini file located in your ~winrunnerdat directory. 

3. Add the function you want to add and the parameter of the function you want the Data wizard to change. 

4. Save the file 

5. Bring up WinRunner Again.

 6. Your function should now work with the data wizard 

Date:2003-02-09 00:00:00

Post Your Answers

User Email:

User Name:

Related TESTING Subjective Links

TESTING Subjective interview questions and answers for experienced and fresher