This tutorial demonstrates how to do parameterization to login 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. We will restrict to just 3 of possible 8 combinations.
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."
When you click on "expert view" you will see that "Agent Name" is replaced by "Guru", and the type of sheet used.
What this Data sheet 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 data in the second row and so on. Now lets 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 data sheet. 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 feature provided by QTP that shows all the constants that could be parameterized in one single window). It makes parameterization of big script easy.