This Script gives result by retreiving values from datatable.
A B
5 5
6 6
7 7
8 8
9 9
In datatable enter test data as shown above.
Fill values below "A" and "B"
script required for DDT(data driven testing)is
val1=datatable("A",1)
val2=datatable("B",1)
res=cint(val1) +cint(val2)
msgbox res
Result will be 10,12,14,16,18.
datatable("column name",sheetname/id)
cint is a function which converts string to integer.
check what will happen if u are not using cint in third step.
just replace this res=val1+val2 in place of res=cint(val1) +cint(val2)
QTPScript for connecting to database
Script for Messagebox to disappear after certain time
QTP Faqs
Manual Faqs
Sql Server Faqs
QTP Script for Data Driven Testing using Datatable
D.P for Flight Application Login
invokeapplication"D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "abcd"
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "47e2b30da686ac4f243e9c695c64fa76c5931577"
Dialog("text:=Login").WinButton("text:=OK").Click
invokeapplication"D:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Above line invokes(opens) flight application login dialog.
syntax to invoke application is invokeapplication"path of application"
To get path of flight application
1.Right click on flight application.
2.Click on properties.
3.Click on General Tab in Flight Properties Window.
4.Copy path that is specified beside location in flight properties window.
5.Paste path beside invokeapplication in double quotes.
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "47e2b30da686ac4f243e9c695c64fa76c5931577"
To get password in encrypted form
Go to Start ->Programs->QuickTest Professional ->Tools->Password Encoder
1.Password Encoder window opens.
2.Type password(mercury)near password textbox.
3.Click on Generate button.
4.U get password in Encoded String textbox(encrypted form).
QTPScript for Data Driven Testing using Datatable
QTPScript for connecting to database
Script for Messagebox to disappear after certain time
Test Scenario for Search Engine
QTP Faqs
Manual Faqs
Sql Server Faqs
Descriptive Programming for Yahoo Login Page
QTP Script to write multiplication table
Script to write multiplication table of 5 in notepad.
Set f=createobject("scripting.filesystemobject")
set g=f.createtextfile("d://xyz.txt")
For i=1 to 10
g.writeline i&"*5="&i*5
Next
createtextfile("d://xyz.txt") creates notepad by name "xyz"in D drive
output of this script in notepad will be
(path-d://xyz.txt)
1*5=5
2*5=10
3*5=15
4*5=20
5*5=25
6*5=30
7*5=35
8*5=40
9*5=45
10*5=50
QTPScript for connecting to database
Types of Testing
Testing Material
Test Scenario for Search Engine
QTP Faqs
Manual Faqs
Sql Server Faqs
Load Runner Faqs
Descriptive Programming for Yahoo Login Page
D.P for getting checkbox checked status
Descriptive Programming to count and close all open browsers
Script to get count,names of all open browsers and to close them.
Set b=Description.Create
b("micclass").value="Browser"
Set obj=Desktop.ChildObjects(b)
msgbox obj.count
For i=0 to obj.count-1
c=obj(i).getroproperty("name")
msgbox(c)
obj(i).Close
Next