PARAMETERIZATION
We can run multiple cases without using FOR LOOP, there is inbuilt functionality in QTP that we can use to run multiple test cases using PARAMETERIZATION.
Below is Sample test case to run multiple test case using PARAMETERIZATION.
Application used : Flight reservation.
Step 1. Record an action to insert a order in Flight reservation.
Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
Window("Flight Reservation").ActiveX("MaskEdBox").Type "121212"
Window("Flight Reservation").ActiveX("MaskEdBox").Type micTab
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").VirtualObject("object").Click 28,9
Window("Flight Reservation").WinEdit("Name:").Set "AAAAAA"
Window("Flight Reservation").WinButton("Insert Order").Click
Now we have the problem statement to insert multiple orders, like in this example we will run first iteration with "AAAAA" and run run second and third iteration with data "BBBBB" and "CCCCC" respectively.
Step 2. Go to Keyword view and click on the button adjacent to Value column "AAAAA" as shown below.
Step 3. It will open "Value configurations options" window as shown below.
Set Parameter as "Data Table"
Name (Of your choice) - I have taken here as "Input_Name"
Location in Data table as "Current action sheet(local)" (Discussion on Global sheet we leave as of now for further posts and discussions)
Press OK -> It will insert a column in data table as shown below :
Step 4. Insert 2 more values "BBBBBBBB" and "CCCCCCC" in row number 3 and 4.
Step 5. Right click on Action -> Click in menu "Action call properties" as shown below
TIP : If menu item "Action call properties" is not there in Menu, then Goto -> Action properties -> uncheck "reusable action" -> OK, menu item "Action call properties" will come now.
Step 6. Set Run on all rows.
Now run the test case - > It will run 3 time for all the values "AAAAAA", "BBBBB" and "CCCCC"