Tutorial-10 How to parameterize our tests using Data-Driver in QTP
How to parameterize our tests using Data-Driver in QTP
With the help of Data Driver utility of QTP, we can easily parameterize all or many test objects or methods, or checkpoints having same constant value in a particular action. The operation here is similar to the �Find & Replace All� process as against time consuming one-by-one �Find & Replace� process. We can replace all instances of a particular constant with a parameter. We can see each & every instance of that constant, by which we can decide whether to parameterize the particular value or not.
This short tutorial guides you to parameterize a value using data driver in QTP.
Step 1: Display the concernedaction desired to be parameterized.
Choose “Tools” > “Data Driver”. The Data Driver does internal scanning of the test looking for various constants for some time and opens the Data Driver.
The list of Constants for the action gets displayed by the Data Driver. Here we can see how many times a particular constant value gets repeated in the action.
By default, we see two types of constants like: 1) The argument value of each Set method 2) The argument value of each Select method
If we want to parameterize a value that is not currently displayed in the list (like an object property value), click “Add Value” to open the “Add Value” dialog box.
Click “OK” after entering a constant value in the dialog box. This will add the constant to the list.
Select the type of parameterization desired to be performed:
a) Step-by-step parameterization:
Enables us to view the current values of each step containing the selected value. For each step, we can choose whether or not to parameterize the value and if so, which parameterization options is required to be used.
b) Parameterize all:
Enables us to parameterize all occurrences of the selected value throughout the action. We set our parameterization preferences one time and the same options are applied to all occurrences of the value.
If we had selected “Step-by-step parameterization” option in step-4, click “Next”. This will open the e “Parameterize the Selected Step” screen.
Had we selected “Parameterize all” option in step-4, the “Parameter details” area gets enabled in the main screen of Data Driver. We can choose the preferences for parameterization in a way similar to the process used for an individual step.
In the “Step to parameterize area”, the first step with an object property, method argument, or checkpoint value containing the selected value is displayed in the test tree on the left. The parameterization options for the step are displayed on the right.
By default, the value is parameterized as a Data Table variable. Accept the default parameterization settings or set the parameterization options you want to apply to this step.
a) Click “Next” to parameterize the selected step and view the next step containing the selected value.
b) Click “Skip” if we don�t want to parameterize the selected step.
c) Click “Finish” to apply the parameterization settings of the current step to all remaining steps containing the selected value.
If we clicked “Next” in Step-6, and steps remain that contain the selected value, the“Parameterize the Selected Step” screen opens displaying the next relevant step. Repeat step previous for each relevant step.
If there are no remaining steps containing the selected value, the Finished screen opens.
Click “Finish”. This will close the “Data Driver Wizard” & the Data Driver main screen shows how many occurrences we selected to parameterize and how many remain as constants.