hi..
kindly let me know how to use data driven testing in qtp using vbscript
i would be glad if provided with example.
regards
gouthami
hi..
kindly let me know how to use data driven testing in qtp using vbscript
i would be glad if provided with example.
regards
gouthami
Data Driven testing is nothing but passing parameters repeatedly and executing the same script with different values
like if you see the below script,
Dim url
url = DataTable.Value ("url",dtLocalSheet)
Create a column in the localsheet of QTP test script and from there passing values to the script
This one was recorded and enhanced when I was learning QTP. I am still learning .
With Window("Flight Reservation")
.Activate
.WinMenu("Menu").Select "File;Open Order..."
With .Dialog("Open Order")
.WinCheckBox("Order No.").Set "ON"
.WinEdit("Edit").Set DataTable("A", dtGlobalSheet)
.WinButton("OK").Click
End With
.WinButton("Update Order").Check CheckPoint("Update Order")
.WinRadioButton("First").Set
.WinButton("Update Order").Check CheckPoint("Update Order_2")
.WinButton("Update Order").Click
End With
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.
-sutnarcha-
well now,i wanted to know abt environment variables.
Hope this will help u for Data Driven Testing in QTP by passing different values thru external data files such as excel.
SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE","","C:\Documents and Settings\Jimohan","open"
Datatable.Import("D:\TestData.xls")
Datatable.AddSheet(1)
row_cnt=datatable.getrowcount
Msgbox row_cnt
For i=1 to row_cnt
Uid=Datatable.Value("Uid",1)
msgbox Uid
Password=Datatable.Value("Password",1)
msgbox Password
Browser("Browser").Page("Yahoo! India").Link("Mail").Click
Browser("Browser").Page("Sign in to Yahoo! India").WebEdit("login").Set DataTable("Uid")
Browser("Browser").Page("Sign in to Yahoo! India").WebEdit("passwd").SetSecure DataTable("Password")
Browser("Browser").Page("Sign in to Yahoo! India").WebButton("Sign In").Click
Browser("Browser").Page("Yahoo! Mail (santhu_2k4)").WebElement("Sign Out").Click
Browser("Browser").Page("Page").Sync
Browser("Browser").Close
Next
datatable.setnextrow
Data driven testing :we will separate the test data from the test case such that data can be changed with out making any effect to the testcase.
So for that we use parameter.
ex:you want to check your application with differernt users.click on username u can seethis sign.give parameter click ok.
It takes to data table you can add any number of users you want.
Data driven means that we run same QTP script using different data.
For example you can create Login script and then use data driven methods to
run that script multiple times with multiple sets of userid and passwords.
1- Using QTP datatables
2- Using Excel sheets
3- Using Access database
You can use ADODB object to get data from Excel and Access and put that data in Arrays or Dictionary object and then can use that data in different scripts.
You can also define in Data that which Actions are going to run. It will be hybrid framework.
give values in datatable like username and password and import the data using datatable.import method.
exatatable.import "C\:Programfiles:\QTP"
Window(" ").page(" ").WinEdit(" ").set Datatable.value("Username")
Window(" ").page(" ").WinEdit(" ").set Datatable.value("Password")