Quality Testing

Quality is delighting customers

my requirement is I want to import data from external excell sheet for data driven testing

Views: 83

Reply to This

Replies to This Discussion

Hi Kishore,

Try the below code to import data from excel sheet. You can see the datas only during runtime. If you want to see all the datas of the excel file which is been imported to the qtp data table, once the run secession ends, go to the qtp result and select run time datatable and check all the datas.
In the below example "default.xls" is the excel file name which is saved in C drive.

To Import all the sheets in the excel file to QTP data table
-----------------------------------------------------------------------------
datatable.Import(FileName)
Datatable.Import ("C:\default.xls")
wait 5

To Import a particular sheet from the excel file to the data table
-----------------------------------------------------------------------------
Syntax - DataTable.ImportSheet(FileName, SheetSource(Excel file sheet), SheetDest(QTP datatable sheet))
EX - Datatable.ImportSheet "C:\default.xls", "empdetails", "Global"
wait 5
Thnaks for ur reply

how to point the rows one by one
Descriptive program to import data from excel sheet
Create an excel sheet in c:\ as data.xls and run the below code

DataTable.Import "C:\data.xls"
For i =1 To 3
myStr =" q" &i
v =DataTable("test" ,dtGlobalSheet)
msgbox(myStr)
Browser("name:=Google Sets").Page("Title:=Google Sets").WebEdit("name:=" &myStr).Set v
DataTable.SetNextRow
Next
Browser("name:=Google Sets").Page("Title:=Google Sets").WebButton("name:=Large Set").Click
Wait(3)
Browser("name:=Google Sets").Close
ExitRun(0)

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service