Single Post
Header
Wednesday, December 19, 2012
Monday, December 10, 2012
QTP Simple Examples with Flight Reservation Application
QTP Simple Examples with Flight Reservation Application
VB Script Simple Programs with Examples
VB Script Simple Programs with Examples
Wednesday, December 5, 2012
How to stop the auto-start of Skype/Google Talk/Torrent on boot up
How to stop the auto-start of any software on boot up
From Windows "start" button, select "run" and in then in the run command window, type MSCONFIG
This will open the "system configuration" window.
Select the "start-up" tab,
Under heading "start-up item" look and see if "Skype/Google Talk/Yahoo Messenger" is shown, and checked. This is telling Windows to start Skype each time it starts windows.
If it is checked, uncheck it.
Click "apply" and then "OK".
vb scripts programs - interview questions
vb scripts programs - interview questions
' Reverse a string using mid function in vb script
'str,strrev,ch,i,l
str = inputbox("enter string")
l = Len(str)
For i = l To 1 Step -1
ch = Mid(str,i,1)
strrev = strrev & ch
Next
msgbox strrev
' mid function returns the characters or string
cba
2.How to use fix function in vb script
'Use of fix() function in vb script
'It will convert floating numbers to integers
a=fix(68.4)
msgbox a
b=fix(-68.4)
msgbox b
-68
3.How to use rnd() function in vb script
'Use of rnd() function in vb script
'The Rnd function generates a random number greater than or equal to 0.0 and less than 1.0.
x=rnd()
y=rnd()
msgbox x&" and "&y
i=rnd(68)
j=rnd(-68)
msgbox i&" and "&j
o/p:
0.705 and 0.502
Dim intMax, iLoop, k, intValue, strChar, strName, intNum
' Specify the alphabet of characters to use.
Const Chars = "abcdefghijklmnopqrstuvwxyz"
' Specify length of names.
intMax = 5
' Specify number of names to generate.
intNum = 3
'Randomize()
For iLoop = 1 To intNum
strName = ""
For k = 1 To intMax
' Retrieve random digit between 0 and 25 (26 possible characters).
intValue = Fix(26 * Rnd())
' Convert to character in allowed alphabet.
strChar = Mid(Chars, intValue + 1, 1)
' Build the name.
strName = strName & strChar
Next
Wscript.Echo strName
Next
uatvs
dihbn
iplmj
edjfb
1. Reverse a string using mid function in vb script
'str,strrev,ch,i,l
str = inputbox("enter string")
l = Len(str)
For i = l To 1 Step -1
ch = Mid(str,i,1)
strrev = strrev & ch
Next
msgbox strrev
' mid function returns the characters or string
O/P :
abccba
2.How to use fix function in vb script
'Use of fix() function in vb script
'It will convert floating numbers to integers
a=fix(68.4)
msgbox a
b=fix(-68.4)
msgbox b
O/P:
68-68
'Use of rnd() function in vb script
'The Rnd function generates a random number greater than or equal to 0.0 and less than 1.0.
x=rnd()
y=rnd()
msgbox x&" and "&y
i=rnd(68)
j=rnd(-68)
msgbox i&" and "&j
o/p:
0.705 and 0.502
4.Generate random names using vb script
Dim intMax, iLoop, k, intValue, strChar, strName, intNum
' Specify the alphabet of characters to use.
Const Chars = "abcdefghijklmnopqrstuvwxyz"
' Specify length of names.
intMax = 5
' Specify number of names to generate.
intNum = 3
'Randomize()
For iLoop = 1 To intNum
strName = ""
For k = 1 To intMax
' Retrieve random digit between 0 and 25 (26 possible characters).
intValue = Fix(26 * Rnd())
' Convert to character in allowed alphabet.
strChar = Mid(Chars, intValue + 1, 1)
' Build the name.
strName = strName & strChar
Next
Wscript.Echo strName
Next
o/p:
snphhuatvs
dihbn
iplmj
edjfb
Friday, October 5, 2012
How to create Weblogic Domain - Step By Step
1.Click on "Getting started with WebLogic Server 10.3.6"
2.Click on "Next" button
3.Click on "Next" button
5.Give any "Naem" and "User password"
6.Here you can choose either "Developement Mode" or "Production Mode"
If you choose "Production Mode" it will user name and pwd when start the weblogic server
8.Here You cn provide Listen Address as your local IP Address. By default the port number would be 7001
If you want , you can change the port number
9.Click on "Create" button
10.You can the server by checking the start admin server checkbox and done
WebLogic 10.3.6 (11g R1) Installation -Step By Step
WebLogic 10.3.6 (11g R1) installation steps in Windows OS:
Java should be already installed in your computer :
1.Just Double on Installation jar file
Java should be already installed in your computer :
1.Just Double on Installation jar file
2.Click on Next
3.Uncheck the check box shown below
4.Click on "yes" button
5.Click on "yes" button
6.Click on "yes" button
7.Click on "continue" button
8.Click on "next" button
9.Choose the Java path from your computer and click on Next
10.Click on Next
11.Click on Next
12.Click on Done ,to start the weblogic server
Monday, October 1, 2012
Flight Reservation Application Testing Examples using QTP (Quick Test Professional)
1. Record and PlayBack
(Login to Flight Reservation ,Book one ticket ,Insert Order
, Send Fax Order
and close)
systemutil.Run "C:\Program Files\Mercury
Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent
Name:").Set "venkatesh"
Dialog("Login").WinEdit("Agent
Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure
"4c639147ce17debfa9a680adf3fb0a1f7b766d39"
Dialog("Login").WinButton("OK").Click
Window("Flight
Reservation").ActiveX("MaskEdBox").Type "081310"
Window("Flight Reservation").WinComboBox("Fly
From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly
To:").Select "London"
Window("Flight
Reservation").WinEdit("Name:").Set "venkat"
Window("Flight
Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights
Table").WinList("From").Activate "13536 FRA 08:00 AM LON 08:45 AM SR
$163.00"
Window("Flight
Reservation").WinEdit("Name:").Set "venkat"
Window("Flight
Reservation").WinButton("Insert Order").Click
Window("Flight
Reservation").WinMenu("Menu").Select "File;Fax
Order..."
' used regular expression at the below Fax Order.Rht
Click on
Dialog and make it Fax Order
No.* .And check the regular expression
Window("Flight Reservation").Dialog("Fax
Order No. 12").ActiveX("MaskEdBox").Type "0809972129"
Window("Flight Reservation").Dialog("Fax
Order No. 12").WinCheckBox("Send Signature with order").Set
"ON"
Window("Flight Reservation").Dialog("Fax
Order No. 12").WinButton("Send").Click
Window("Flight Reservation").Close
2 Descriptive
Programming (Login to Flight
Reservation)
systemutil.run "C:\Program Files\Mercury
Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("text:=Login").WinEdit("attached
text:=Agent Name:").Set "venkatesh"
Dialog("text:=Login").WinEdit("attached
text:=Password:").SetSecure
"4c63941e33c84ad39b70103970c7fe0f8e429f0f"
Dialog("text:=Login").WinButton("text:=OK").Click
Window("text:=Flight Reservation").Close
3.Capture Screen Shot
(using CaptureBitmap)—
Login failed at
Flight Reservation Application
SystemUtil.Run "C:\Program Files\Mercury
Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent
Name:").Set "venkatesh"
'Desktop.CaptureBitmap "d:\login4.png"
Dialog("Login").WinEdit("Password:").SetSecure
"4c0616cda83a5c9f88633cdaff4c044c"
Dialog("Login").WinButton("OK").Click
dialog("Login").Dialog("Flight
Reservations").CaptureBitmap "d:\login.bmp"
bexists=Dialog("Login").Dialog("Flight
Reservations").Exist(2)
If bexists Then
smsg=Dialog("Login").Dialog("Flight
Reservations").GetVisibleText
reporter.ReportEvent
micFail,"Login",smsg
Dialog("Login").Dialog("Flight
Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
exittest
End If
4. Reusable Action (Flight Reservation Example)
Action1: (Login with
incorrect password and cacel)
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").WinEdit("Agent
Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure
"4c0616cda83a5c9f88633cdaff4c044c"
Dialog("Login").WinButton("OK").Click
bexists=Dialog("Login").Dialog("Flight
Reservations").Exist(2)
If bexists Then
smsg=Dialog("Login").Dialog("Flight
Reservations").GetVisibleText
reporter.ReportEvent
micFail,"Login",smsg
Dialog("Login").Dialog("Flight
Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
End If
runaction "Action3",oneiteration
Action2:
msgbox
"welcome to action2"
Action3: (Reusable
Action) used in Action1 : (Login with correct password)
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").WinEdit("Agent
Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure
"4c06513879e8c9aae96f878ebd40924cb403de52"
Dialog("Login").WinEdit("Password:").Type micReturn
Window("Flight Reservation").Close
5. Regular Expression
and Parameterization
(Login to Flight
Reservation application, insert order and send fax information)
(need to create
fax_no in global sheet with fax numbers)
' Use of Regular Expressions and Parameterization
' Insert Order and Send Fax
systemutil.Run "C:\Program Files\Mercury
Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent
Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure
"4c63b0b0656069024c0d34dd2f5745a7b3780b8a"
Dialog("Login").WinButton("OK").Click
Window("Flight
Reservation").ActiveX("MaskEdBox").Type "081410"
Window("Flight Reservation").WinComboBox("Fly
From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly
To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights
Table").WinList("From").Activate "19138 LON
08:00 AM LAX 08:45 AM
AA $102.00"
Window("Flight
Reservation").WinEdit("Name:").Set "venky"
Window("Flight Reservation").WinButton("Insert
Order").Click
Window("Flight
Reservation").WinMenu("Menu").Select "File;Fax
Order..."
' Rht click on the dialog
below and make .* and check the
regular expression
Window("Flight Reservation").Dialog("Fax
Order No. 21").ActiveX("MaskEdBox").Type
DataTable("fax_no", dtGlobalSheet)
Window("Flight Reservation").Dialog("Fax
Order No. 21").WinButton("Send").Click
Window("Flight Reservation").Close
6.Shared Object
Repository
a.(Record Login to Flight Reservation. Goto--Resouces--Object
Repository(File--Export Local Objects).It will save as .tsr file)
systemuti.run "C:\Program Files\Mercury
Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent
Name:").Set "venkatesh"
Dialog("Login").WinEdit("Password:").SetSecure
"4c63bd987f7ea31db67d4ec3760e762a901d3161"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close
How
to use it :
Goto--Resources--Associate
Repositories--Browse the .tsr file and add it.We can't edit this shared O.R.
b.
Goto--Resources--Object
Repository Manager--(Objects--Add Objects).File--Save As.It will save as .tsr
file
7. How to use Library
Functions
a.
addition.vbs
Function
add
a=20
b=30
c=a+b
msgbox "The addition of a and b is :
"&c
End
Function
b.
multiplication.vbs
Function
mul
a=4
b=5
c=a*b
msgbox
"The multiplication of a and b is :"&c
end
function
(File--Settings--Resources--Browse
files)
8.Give different
keywords at google and search (used descriptive programming and
parameterization)
Set
ie=createobject("internetexplorer.application")
ie.navigate("http://www.google.co.in/")
ie.visible=true
Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Set
DataTable("search_keywords",dtGlobalSheet)
Browser("title:=Google").Page("title:=Google").WebButton("value:=Google
Search").Click
Browser("opentitle:=Google").Close
9.Store Results in
Excel
Set xl=
CreateObject("Excel.application")
set wb=xl.workbooks.open("d:/sample2.xls")
Set ws=wb.worksheets(1)
a=15
b=20
If a>b Then
ws.Cells(1,1).Value
="a is bigger"
ws.Cells(1,2).value="PASS"
Reporter.ReportEvent micDone,"a is bigger", a
Else
ws.Cells(1,1).Value = "b is bigger"
ws.Cells(1,2).value = "FAIL"
ws.cells(1,2).font.bold=true
ws.cells(1,2).font.size=12
ws.Cells(1,2).font.colorindex=50
Reporter.ReportEvent micFail
,"b is bigger" , b
End If
wb.save
wb.close
Set ws=nothing
Set wb=nothing
Set xl=nothing
Sunday, September 30, 2012
Small Examples in QTP
1.Record
and Play Back in qtp (Login and Close)
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”).WinEdit(“Agent
Name:”).Set “abcd”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c03551c45cb9c6ce024f12617d6e7f461936ba5″
Dialog(“Login”).WinButton(“OK”).Click
Window(“Flight
Reservation”).Close
2.
How to create excel file to store results for qtp
Set xl= CreateObject(“Excel.application”)
xl.Visible
= True
xl.Workbooks.add
a=15
b=20
If
a>b Then
xl.ActiveSheet.Cells(1,1).Value
= a
Reporter.ReportEvent
micDone,”a is bigger”, a
Else
xl.ActiveSheet.Cells(1,1).Value
= b
Reporter.ReportEvent micDone ,”b is bigger” , b
End
If
3.
How to store Store results in excel using qtp
‘
This is one of the method for importing excel in qtp
set
xl=createobject(“excel.application”)
set
wb=xl.workbooks.open(“D:\myexcel.xls”)
a=15
b=20
If
a>b Then
wb.ActiveSheet.Cells(1,1).Value
= a
Reporter.ReportEvent
micDone,”a is bigger”, a
Else
wb.ActiveSheet.Cells(1,1).Value
= b
Reporter.ReportEvent micDone ,”b is bigger” , b
End
If
wb.save
wb.close
set
wb=nothing
set
xl=nothing
4.How
to use global and Local Data Sheets in qtp
In
Blank Test Case by default one action would be created.
Then
write the below code in Action1–>Expert View
gd=DataTable(“Names_Global”,
dtGlobalSheet)
ld=DataTable(“College”,
dtLocalSheet)
msgbox
gd&”_”&ld
Goto
insert —>Call to new action and then it would create action2
Then
write the below code in Action2–>Expert View
gd=DataTable(“Names_Global”,dtGlobalSheet)
ld=DataTable(“Number”,dtLocalSheet)
msgbox
gd&”_”&ld
Put
any data in Global ,Action1 and Action2 sheets and then execute.
In
the above Names_Global,College and Number are the user defined coloumn names in
the
corresponding
sheets
1.If
we do not give application path
object
did not find error
2.For
textboxes---WinEdit
buttons-----Winbutton
menu--------Winmenu
dropdownlist---WinComboBox
3.What
is logical name
it
is a unique name under which specific physical description of a respective
object to store
Questions and Answers for Actions in QTP
1.What
is an action in QTP
Ans:
Action
is nothing but a specific task under one test
(Ex:
Login is one action and Payment is another action)
(We
can make them both in one action but it would be better if they are different)
2.How
to call an action in QTP
Ans.
RunAction
“Action2[Action Name]“,oneIteration, parameters
3.What
is reusable action in QTP
Ans.
To
call an action from other tests we must make it as reusable so that scope
becomes global and can be called from any test.
A
reusable action can be called and executed but not editable in the current
test.
4.How
many types of actions are there in QTP
Ans.
i)Non-Reusable
Action :an action that can be called only in the test with which it is stored,
and can be called only once.
ii)Reusable
Action : an action that can be called multiple times by the test with which it
is stored (the local test) as well as by other tests.
iii)External
Action : a reusable action stored within another test.
External
actions are read-only in the calling test.
The
below are not types of actions.
Internal
Action : an action which is created locally under one test . Eventhough if it
is reusable action , it would be internal action
Independent
Action : an action which is not dependent on any other action
Dependant
Action :an action which is depend on other action(s)
Examples for actions in qtp
1.
How to create actions while recording in qtp
Create
Blank TestCase. Goto –>Record .Open ur
Flight Reservation application
Do
the record for login (Enter Agent Name and Mercury Password).Then the script
would be
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c04981da8da89eb8a871793145df8e386047656″
Dialog(“Login”).WinButton(“OK”).Click
Goto
insert —>Call to new action and then it would create action2.
Then
go for File–>Open Order and give orger number (Ex:5) and ok.Then the script
would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “5″
Window(“Flight
Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Goto
insert —>Call to new action and then it would create action3.
Close
the Flight Reservation application.Then the script would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).Close
2.How
to create actions for data table from Keyword View in qtp
Create
Blank TestCase. Goto –>Record .Open ur
Flight Reservation application
Action1
:
Do
the record for login (Enter Agent Name and Mercury Password).Then the script
would be
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c04981da8da89eb8a871793145df8e386047656″
Dialog(“Login”).WinButton(“OK”).Click
Action2
:
Goto
insert —>Call to new action and then it would create action2.
Then
go for File–>Open Order and give orger number (Ex:5) and ok.Then the script
would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “5″
Window(“Flight
Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Action3
:
Goto
insert —>Call to new action and then it would create action3.
Close
the Flight Reservation application.Then the script would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).Close
Fill
the data in the global sheet. Ex:
Make
the A name as Login and B name as Password
Give
any name (Ex: venkatesh for login and mercury for password)
Fill
the data in the Action2. Ex:
Make
the A name as Order Number
Give
some numbers (Ex: 3,45,8 )
Goto
KeyWord View
Action1
Login
:
AgentName
Set Value
Click
on the value.There choose Parameter:DataTable.
Name
:Choose Login
Ok
Same
thing for password field.
Name
:Choose Password
Ok
Action2
Flight
Reservation
Open
Order
Edit set “some number” click there
There
choose Parameter:DataTable.
Location
in the datatable :current action
ok
Now
you look into the expert view and see the code .
There
automatically code would be change
Goto–Action1–>Right
Click–>Action Call Properties–>Run on all rows
Goto–Action2–>Right
Click–>Action Call Properties–>Run on all rows
Execute
it.
execute
it
3.How
to create actions for data table in qtp
Action
1:
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”).WinEdit(“Agent
Name:”).Set DataTable(“Login”, dtGlobalSheet)
Dialog(“Login”).WinEdit(“Password:”).SetSecure
DataTable(“Password”, dtGlobalSheet)
Dialog(“Login”).WinButton(“OK”).Click
Action2
:
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set DataTable(“OpenOrder”,
dtLocalSheet)
Window(“Flight
Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Action3:
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).Close
4.How
to reuse actions in qtp
Step
1:Create Blank Test.
Goto
–>Record .Open ur
Flight Reservation application
Do
the record for login (Enter Agent Name and Mercury Password).Then the script
would be
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c04981da8da89eb8a871793145df8e386047656″
Dialog(“Login”).WinButton(“OK”).Click
Goto
insert —>Call to new action and then it would create action2.
Then
go for File–>Open Order and give orger number (Ex:5) and ok.Then the script
would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).WinMenu(“Menu”).Select “File;Open Order…”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight
Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “5″
Window(“Flight
Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
Goto
insert —>Call to new action and then it would create action3.
Close
the Flight Reservation application.Then the script would be
Window(“Flight
Reservation”).Activate
Window(“Flight
Reservation”).Close
Now
Goto—>KeyWord view–>Rht Click on Action1 –>Action Properties–>There
u choose the option
for
Reusable action (Then action1 is called
reusable action)
(Note
: You need to give the reuasable action to the corresponding action)
Step2
: Now we can use action1 (which we made as reusable)
Create
blank test
Goto–>Keyword
view–>Rht Click on action1–>Insert Call to Existing Action
There
u can browse the actions and choose (Ex:Action1).
Then
you can execute
5.How
to exit from the test in actions using exittest in qtp
Action1
:
No
need to goto record mode.Just goto Object Repository and add objects to local
Open
ur flight
application and click on log in window.click ok
write
the below code in expert view
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c0616cda83a5c9f88633cdaff4c044c”
Dialog(“Login”).WinButton(“OK”).Click
bexists=Dialog(“Login”).Dialog(“Flight
Reservations”).Exist(2)
If
bexists Then
smsg=Dialog(“Login”).Dialog(“Flight
Reservations”).GetVisibleText
reporter.ReportEvent
micFail,”Login”,smsg
Dialog(“Login”).Dialog(“Flight
Reservations”).WinButton(“OK”).Click
Dialog(“Login”).WinButton(“Cancel”).Click
exittest
End
If
Action2:
Open
ur flight
application login and login with agent name and pwd
No
need to goto record mode.Just goto Object Repository and add objects to local
click
on FlightReservation window. click ok
write
the below code in expert view
window(“Flight
Reservation”).Activate
window(“Flight
Reservation”).Close
6.How
to exit from the action in actions using exitaction in qtp
Action1
:
No
need to goto record mode.Just goto Object Repository and add objects to local
Open
ur flight
application and click on log in window.click ok
write
the below code in expert view
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c0616cda83a5c9f88633cdaff4c044c”
Dialog(“Login”).WinButton(“OK”).Click
bexists=Dialog(“Login”).Dialog(“Flight
Reservations”).Exist(2)
If
bexists Then
smsg=Dialog(“Login”).Dialog(“Flight
Reservations”).GetVisibleText
reporter.ReportEvent
micFail,”Login”,smsg
Dialog(“Login”).Dialog(“Flight
Reservations”).WinButton(“OK”).Click
Dialog(“Login”).WinButton(“Cancel”).Click
exitaction
End
If
msgbox
“it will not execute”
Action2:
Open
ur flight
application login and login with agent name and pwd
No
need to goto record mode.Just goto Object Repository and add objects to local
click
on FlightReservation window. click ok
write
the below code in expert view
window(“Flight
Reservation”).Activate
window(“Flight
Reservation”).Close
7.How
to call action in qtp
(qtp
reusable action example)
To
call any action in qtp using RunAction, that action should be made as reusable
Follwing
example has 3 actions. I am calling Action3 in Action1
Action1
:
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c0616cda83a5c9f88633cdaff4c044c”
Dialog(“Login”).WinButton(“OK”).Click
bexists=Dialog(“Login”).Dialog(“Flight
Reservations”).Exist(2)
If
bexists Then
smsg=Dialog(“Login”).Dialog(“Flight
Reservations”).GetVisibleText
reporter.ReportEvent
micFail,”Login”,smsg
Dialog(“Login”).Dialog(“Flight
Reservations”).WinButton(“OK”).Click
Dialog(“Login”).WinButton(“Cancel”).Click
End
If
runaction
“Action3″,oneiteration
Action2
:
msgbox
“welcome to action2″
Action3
:
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”).WinEdit(“Agent
Name:”).Set “venkatesh”
Dialog(“Login”).WinEdit(“Password:”).SetSecure
“4c06513879e8c9aae96f878ebd40924cb403de52″
Dialog(“Login”).WinEdit(“Password:”).Type micReturn
Window(“Flight
Reservation”).Close
Execute
it.It will execute in the below sequence.
Action1–>Action3
Action2–>Action3
Subscribe to:
Posts (Atom)