-->Data Driven Test (or) Parameterization

In order to test an application with multiple sets of test data, we need to parametrize the script. And the multiple test data can be drive through an excel sheet called data table.

In order to create a DDT, first we need to create a basic script on the application either by recording or manually writing/ generated. Then we can parametrize the script using the “Data Driver Wizard” or “Data Table Object Methods”.
The test data should be available in the data table to execute a DDT.

Steps to create a DDT using Data Driver Wizard:
1.Create basic script on the application
2.Select Tools --> Data Driver (it automatically displays the values which needs to be parametrized)
3.Select a value to be parametrized & click on parameter button
4.Click on Next --> Click on Parameter options button
5.Provide the parameter name
6.Select the location in the data table as Global sheet
7.Click on OK --> Click on Finish
8.Repeat the above steps for each value to be parametrized

Eg: Window(“Form1”).VbEdit(“Text1”).Set datatable(“num1,dtglobalsheet)
Window(“Form1”).VbEdit(“Text2”).Set datatable(“num2,dtglobalsheet)
Window(“Form1”).VbButton(“Add”).Click

Logic behind DDT:
When we execute a DDT
1. It counts the number of records in the data table
2. It forms a loop internally with the record s count from the data table
3. For each iteration the corresponding record is selected from the data table
4. For each selected record, it will execute all the parametrized values.
Steps to edit data table iteration option:
1. Select File --> Settings
2. Click on num tab
3. Select the required data table iteration option
4. Click on Apply & OK.

Eg:
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set DataTable("Uid", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("Pwd", dtGlobalSheet)
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist Then
Window("Flight Reservation").Close
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
If Dialog("Login").Dialog("Flight Reservations").Exist Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
If Dialog("Login").Dialog("Flight Reservations").Exist Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
End If
If Dialog("Login").Exist<>true Then
Invokeapplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If
End If