Data Table Methods:
Ex1:
x="sai"
Datatable.SetCurrentRow(5)
Datatable.Value(1,1) = x
wait(2)
enter the values if the script not run.
--------------------------------------------------------------------------------------
For Order_Number= 1 to 10 Step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set Order_Number
Wait 1
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Next
--------------------------------------------------------------------------------------
'Dynamic submision of Test data
For i= 1 to 3 Step 1
Agent=InputBox("Enter Agent Name")
Password=InputBox("Enter Password")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Password:").Set Password
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
------------------------------------------------------------------------------------------------------------------
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable("Agent", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("Password", dtGlobalSheet)
wait 1
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Parametrization using DataTable Methods:
--------------------------------------------------------------------------------------------------------------
'Data Driven Testing Using Data Table methods and Programmatic Statements
'Add New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Test data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls", 1, "Login"
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to 5 step 2
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2,3)
Wait 1
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
--------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
SystemUtil.CloseDescendentProcesses
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
----------------------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
------------------------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements and
'Export the Result and Error Messages to an External file
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
DataTable(4,3) = Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at").GetROProperty("text")
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
---------------------------------------------------------------------------------------------------------------------------------
Ex1:
x="sai"
Datatable.SetCurrentRow(5)
Datatable.Value(1,1) = x
wait(2)
enter the values if the script not run.
--------------------------------------------------------------------------------------
For Order_Number= 1 to 10 Step 1
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set Order_Number
Wait 1
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Next
--------------------------------------------------------------------------------------
'Dynamic submision of Test data
For i= 1 to 3 Step 1
Agent=InputBox("Enter Agent Name")
Password=InputBox("Enter Password")
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set Agent
Dialog("Login").WinEdit("Password:").Set Password
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
------------------------------------------------------------------------------------------------------------------
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable("Agent", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Set DataTable("Password", dtGlobalSheet)
wait 1
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Parametrization using DataTable Methods:
--------------------------------------------------------------------------------------------------------------
'Data Driven Testing Using Data Table methods and Programmatic Statements
'Add New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Test data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls", 1, "Login"
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to 5 step 2
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2,3)
Wait 1
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
Next
--------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
SystemUtil.CloseDescendentProcesses
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
----------------------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
------------------------------------------------------------------------------------------------------------------------------
'Data Driven Testing using data table methods and Programmatic Statements and
'Export the Result and Error Messages to an External file
'Adding New Sheet to Run-time Data Table
DataTable.AddSheet "Login"
'Import Data from an external file
DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\input.xls",1, 3
Rows_Count=DataTable.GetSheet("Login").GetRowCount
For i= 1 to Rows_Count Step 1
DataTable.SetCurrentRow(i)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable(1,3)
Dialog("Login").WinEdit("Password:").Set DataTable(2, 3)
Wait 2
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist(12) Then
Window("Flight Reservation").Close
DataTable(3, 3)="Login Successful"
Else
DataTable(4,3) = Dialog("Login").Dialog("Flight Reservations").Static("Agent name must be at").GetROProperty("text")
If Dialog("Login").Dialog("Flight Reservations").Exist(3) Then
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If
DataTable(3, 3)="Login Failed"
End If
Next
DataTable.ExportSheet "C:\Documents and Settings\Administrator\Desktop\Result1.xls","Login"
---------------------------------------------------------------------------------------------------------------------------------
No comments
Post a Comment