HP QTP Data Driven Framework

HP quick Test Professional Data Driven Framework will create using QTP Data Driven Methods

We can prepare HP QTP Data Driven Framework using below procedure or steps



Steps to Create Data Driven Framework:


Using Creating Search Flight Reservation Login

1.Create Framework folder structure Folders are

1.Object Repository
2.Test Scripts
3.Test Data
4.Test Log

2.Create Flight Reservation xls with Username,password and Reservation parameters and paste into Test Data folder.
3.Create Object Repository  of  Flight Reservation and save it in Object Repository folder.
4.Associate Object Repository to Test Scripts.

Test Script:

Option Explicit
Dim RowCounts ,k

'Add new sheet
DataTable.AddSheet "Test_Data"
'Import Test_Data sheet
DataTable.ImportSheet "E:\Automation\FlightReservation\FlightReservation.xls","Login","Test_Data"

'Count Number of row count in Input sheet
RowCounts = DaaTable.GetSheet("Test_Data").GetRowCount

'Use for loop to run multiple data
For k=1 to RowCounts Step 1
DataTable.SetCurrentRow(k)

'Open Flight Application
SystemUtil.Run "Flight reservation application path .exe"

Uname= DataTable.Value("AgentName","Test_Data")
Pwd = DataTable.Value("Password","Test_Data")

Dialog("Login").WinEdit("Agent Name").Set Uname
Dialog("Login").WinEdit("Password").Set Pwd
Dialog("Login").WinButton("OK").Click

If Window("Flight Reservation").exist Then

Reporter.ReportEvent micPass "Verify Flight Reservation Login","Test Case is Pass"
DataTable.Value("Test_Results","Test_Data") = "Test Case is Pass"
Window("Flight Reservation").Close

else

Reporter.ReportEvent micFail "Verify Flight Reservation Login","Test Case is Fail"
DataTable.Value("Test_Result","Test_Data") = "Test Case is Fail"
Dialog("Login").Dialog("Flight Reservation").Winbutton("OK").Click
Dialog("Login").WinButton("Cancel").Click

End If

Next

DataTable.ExportSheet "E:\Automation\FlightReservation\TestLog\FlightReservation_Results.xls","Test_Data"

5.Save the Scripts in Test Script folder
6.Run the Test Script
7.Verify Results of Test Script in Test Log folder with excel data.


No comments:

Post a Comment