HI 2 all
How to pass parameters from excel sheet into an application form through qtp. i need code to perform this task.so plz help me......
bye
HI 2 all
How to pass parameters from excel sheet into an application form through qtp. i need code to perform this task.so plz help me......
bye
Last edited by jainbrijesh; 09-18-2007 at 05:15 AM.
I think you are talking about data driven testing
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.
-sutnarcha-
hi thanx for replying yes data driven testing..iam new to qtp.if uknow plz help me out if possible.
thanx
bye
You need to create objects in Excel to do that as follows -
set sh = CreateObject("Scripting.FileSystemObject")
set exl = CreateObject("Excel.Application")
exl.visible = true
excel_path = Datatable.Value("p_path_mainxls")
set wb = exl.WorkBooks.Open(excel_path)
'Open the intended worksheet
set ws_content = wb.Worksheets("Sheet1")
ws_content.Activate
list_value = exl.ActiveSheet.Cells(5,4).Value
'Then you can use this list_value to pass onto the application like,
Browser().Page().WebEdit().Set list_value
dsharma's examples are correct
If the data is to be taken from QTP's Data Table, then the following statement should help you...
Window("XYZ ABC").Dialog("OPEN").WinEdit("Edit").Set DataTable("A", dtGlobalSheet)
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.
-sutnarcha-
hi below is the code, if ur external datatable contian more than one iteration....
DataTable.Importsheet "Path of the excel.Xls","Sourcesheet",Designationsheet",
iRowCnt = DataTable.GetSheet.GetRowCount
For iNumber=1 to iRowCnt
DataTable.SetCurrentRow(iNumber)
v_iretriveValFrmDataTable = DataTable("ColumnName","")
Next
Also there is one easy way is follow what the process mentioned in the QTP help book. thats the easiest way to start working on the Data Driven Testing.
Whatever dsharma has written the code is correct and it works properly.
Arun*
hi
plz try this once
DataTable.AddSheet"login"
DataTable.ImportSheet"C:\Documents and Settings\Administrator\Desktop\Book1.xls","input","login"
rc=DataTable.GetSheet("login”).Getrowcount
For i=1 to rc
DataTable.SetCurrentRow(i)
systemutil.Run"C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set DataTable("UserId",3)
Dialog("Login").WinEdit("Password:").SetSecure DataTable("Password",3)
Dialog("Login").WinButton("OK").Click
If (Window("Flight Reservation").Exist) then
reporter.ReportEvent 0,"Given Test is ","pass"
DataTable.Value("Result",3)="pass"
else
reporter.ReportEvent 1,"Given Test is ","fail"
DataTable.Value("Result",3)="fail"
end if
Window("Flight Reservation").Close
DataTable.SetNextRow
next
DataTable.ExportSheet"c:\Documents and Settings\Administrator\Desktop\Book1.xls",3
Regards
gopathi