qtp excel scripts

Add to Favourites
Post to:

1) Data Driven Testing through an External Excel Sheet Set myExcel=Createobject("Excel.Application") Set myFile=myExcel.workbooks.open ("C:\Documents and Settings\admin\My Documents\gcreddy.xls") Set mySheet=myFile.worksheets("Sheet1") Rows_Count=mySheet.usedrange.rows.count For i= 1 to Rows_Count Agent=mySheet.cells(i,"A") pwd=mySheet.Cells(i,"B") SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").Activate Dialog("Login").WinEdit("Agent Name:").Set Agent Dialog("Login").WinEdit("Password:").SetSecure pwd Dialog("Login").WinEdit("Password:").Type micReturn Window("Flight Reservation").Close Next 2) Exporting Data from a Database to an Excel Sheet Dim con,rs Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.provider="microsoft.jet.oledb.4.0" con.open"C:\Documents and Settings\admin\My Documents\gcr.mdb" rs.open"select*from Login",con Set ex=createobject("Excel.Application") Set a=ex.workbooks.open("C:\Documents and Settings\admin\My Documents\gcr.xls") Set b=a.worksheets("sheet1") i=1 Do While Not rs.EOF b.cells (i,1).value=rs.fields("agent") b.cells(i,2).value=rs.fields("password") rs.movenext i=i+1 Loop a.save a.close For QTP Information: www.gcreddy.com For Manual Testing: www.gcreddy.net For more QTP Information & Scripts visit: www.gcreddy.com 2 For Manual Testing docs visit: www.gcreddy.net

Description
vb script excel object model scripts for qtp testing.

Comments

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
95 Followers

Your Facebook Friends on WizIQ

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect