What is QTP Parameterization?
QTP provides us to pick different test inputs at a run time. This process of providing different input values through external parameters is called as parameterization.
Types of parameterization in QTP
Parameter types can be:
- Data Table parameters
- Test/Action parameters
- Environment variable parameters
- Random number parameters
Parameterization in QTP
This Micro Focus UFT tutorial demonstrates how to do parameterization to log in successfully to flight reservation application. You may be wondering why take the Herculean effort to automate this simple scenario. We will check that user successfully logs in to the application on inputting valid Agent Name & Password. The need for parameterization becomes obvious if we extend the scope of the scenario to include a Combination of valid ALPHANUMERIC Agent Name & Password. In this case, the Test Steps Will Remain the Same. But we will have more combinations of Data to TEST. In this example, we will restrict to just 3 of possible 8 combinations.
|Test Scenario||Test Steps||Test Data|
|Check that user successfully logs in |
to the application on inputting a
COMBINATION OF valid ALPHANUMERIC
Agent Name & Password
|Step 1) Open Flight Reservation Application |
Step 2) Enter Valid Agent Name
Step 3) Enter Valid Password
Step 4) Press Ok
Step 5) Close Application After Successful Login.
|Agent Name = Guru |
Password = Mercury
Agent Name = Guru99
Password = MERCURY
Agent Name = 9999
Password = mercury
To achieve this, you can either copy the six steps or give different data values that are in fact something you would do manually, or you can use Parametrization.
The easiest way to parameterize an argument, in our case Guru is
- Click Keyword View
- Click the Parametrization Icon.
Value Configuration Dialog Box Opens. Currently, the value is set to a Constant. Click on Parameter Radio Button. QTP assigns a default name to this parameter. You can give a name of your choice and then click "OK."
In the Global Sheet, a column with Header "Agent Name" and value Guru is created. You can enter more values for this parameter.
When you click on "expert view" you will see that "Agent Name" is replaced by "Guru", and the type of sheet used.
Likewise, you can also parameterize the argument Password and enter different test data sets.
What this Datasheet means is QTP will iterate the same six steps that we have recorded three times. During the first iteration, it will use the data in the first row. During the second it will use the data in the second row and so on. Now let's run the script. This is the first iteration. This is the second iteration. In the status bar, QTP gives information of the row, it is currently using as test data and highlights the corresponding row in the datasheet. The results will show a summary of the 3 iterations.
Advantages of Parameterization
- Parameterization allows us to pick different values at run time
- It Reduces Time and Effort
- Usage of Data Drivers allows us to use the same data for various input boxes. (Data Drivers is a feature provided by HP UFT that shows all the constants that could be parameterized in one single window. It makes parameterization of big script easy.