Interview Questions

How to use data driver wizard?

Mercury WinRunner FAQ

(Continued from previous question...)

How to use data driver wizard?

You can use the DataDriver Wizard to convert your entire script or a part of your script into a data-driven test. For example, your test script may include recorded operations, checkpoints, and other statements that do not need to be repeated for multiple sets of data. You need to parameterize only the portion of your test script that you want to run in a loop with multiple sets of data.

To create a data-driven test:

  • If you want to turn only part of your test script into a data-driven test, first select those lines in the test script.
  • Choose Tools - DataDriver Wizard.
  • If you want to turn only part of the test into a data-driven test, click Cancel. Select those lines in the test script and reopen the DataDriver Wizard. If you want to turn the entire test into a data-driven test, click Next.
  • The Use a new or existing Excel table box displays the name of the Excel file that WinRunner creates, which stores the data for the data-driven test. Accept the default data table for this test, enter a different name for the data table, or use
  • The browse button to locate the path of an existing data table. By default, the data table is stored in the test folder.
  • In the Assign a name to the variable box, enter a variable name with which to refer to the data table, or accept the default name, table.
  • At the beginning of a data-driven test, the Excel data table you selected is assigned as the value of the table variable. Throughout the script, only the table variable name is used. This makes it easy for you to assign a different data table
  • To the script at a later time without making changes throughout the script.
  • Choose from among the following options:
    1. Add statements to create a data-driven test: Automatically adds statements to run your test in a loop: sets a variable name by which to refer to the data table; adds braces ({and}), a for statement, and a ddt_get_row_count statement to your test script selection to run it in a loop while it reads from the data table; adds ddt_open and ddt_close statements
    2. To your test script to open and close the data table, which are necessary in order to iterate rows in the table. Note that you can also add these statements to your test script manually.
    3. If you do not choose this option, you will receive a warning that your data-driven test must contain a loop and statements to open and close your datatable.
    4. Import data from a database: Imports data from a database. This option adds ddt_update_from_db, and ddt_save statements to your test script after the ddt_open statement.
    5. Note that in order to import data from a database, either Microsoft Query or Data Junction must be installed on your machine. You can install Microsoft Query from the custom installation of Microsoft Office. Note that Data Junction is not automatically included in your WinRunner package. To purchase Data Junction, contact your Mercury Interactive representative. For detailed information on working with Data Junction, refer to the documentation in the Data Junction package.
    6. Parameterize the test: Replaces fixed values in selected checkpoints and in recorded statements with parameters, using the ddt_val function, and in the data table, adds columns with variable values for the parameters. Line by line: Opens a wizard screen for each line of the selected test script, which enables you to decide whether to parameterize a particular line, and if so, whether to add a new column to the data table or use an existing column when parameterizing data.
    7. Automatically: Replaces all data with ddt_val statements and adds new columns to the data table. The first argument of the function is the name of the column in the data table. The replaced data is inserted into the table.
  • The Test script line to parameterize box displays the line of the test script to parameterize. The highlighted value can be replaced by a parameter. The Argument to be replaced box displays the argument (value) that you can replace with a parameter. You can use the arrows to select a different argument to replace.
    Choose whether and how to replace the selected data:
    1. Do not replace this data: Does not parameterize this data.
    2. An existing column: If parameters already exist in the data table for this test, select an existing parameter from the list.
    3. A new column: Creates a new column for this parameter in the data table for this test. Adds the selected data to this column of the data table. The default name for the new parameter is the logical name of the object in the selected. TSL statement above. Accept this name or assign a new name.
  • The final screen of the wizard opens.
    1. If you want the data table to open after you close the wizard, select Show data table now.
    2. To perform the tasks specified in previous screens and close the wizard, click Finish.
    3. To close the wizard without making any changes to the test script, click Cancel.

(Continued on next question...)

Other Interview Questions