Using the Data Driver to Parameterize Your Test in QTP in Testing

The data driver enables you to quickly parameterize several property values for test objects, checkpoints and method arguments containing the same constant value within a given action.

You can choose to replace all occurrences of a selected constant value with a parameter in the same way that you can use a Find and Replace All operation instead of a step-by-step Find and Replace process.

To parameterize a value using the Data Driver:

  1. Display the action you want to parameterize.
  2. Choose Tools > Data Driver.

    select-data-driver.jpg

    Quick Test scans the test for constants before the Data Driver opens. The data driver displays the Constants list for the action. For each constant value, it displays the number of times the constant value appears in action.

    data-driver.jpg

  3. If you want to parameterize a value that is not currently displayed in the list click Add Value. The Add Value dialog box opens. Enter a constant value in the dialog box and click OK. The constant is added to the list.

    Add-Value.jpg
     
  4. Select the value you want to parametrize from the Constants list and click Parametrize. The data driver wizard opens.

    data-driver-wizard.jpg

  5. If you selected Step-by-step parametrization, click Next. The parametrize the selected step screen opens. If you selected Parametrize all, the parameter option is enabled in the Configure value area. Select your parametrization preferences the same way that you would for an individual step.

    parametrize-the-selected-step.jpg
     
  6. In the Step to parametrize area the first step with an object property or checkpoint value containing the selected value is displayed in the test tree on the left.
  7. Click next to parametrize the selected step and view the next step.

    next-selected-step.jpg

  8. Click Skip if you do not want to parametrize the selected step.
  9. Click Finish to apply the parametrization settings of the current step to all remaining steps containing the selected value. The Data Driver Wizard closes and the Data Driver main screen shows how many occurrences you selected to parametrize and how many remain as constants.

    parametrized-finish.jpg

  10. When your are finished with the parametrization constants click OK. The parametrization options you selected are applied to your action.