Explain types of exception handling and script for that?

Answer Posted / shyam prasad

' Script :: Login
' Date ::
' Input Values :: dtable,text,mydate
'Last Modified ::

Option explicit
Dim dtable,text,mydate,url
url="C:\Program Files\Mercury Interactive\QuickTest
Professional\samples\flight\app\flight4a.exe"
mydate=(mid(date,1,6)& right(date,2)) 'For Current Date Use
this statement
'mydate=(right(date,2)& mid(date,3,4)& right(date,2))
'datatable.GlobalSheet.AddParameter "Date", mydate
'datatable.Value(1,1)=mydate
datatable.Import("C:\Documents and
Settings\Shyam\Desktop\QTP_Script\User_Login\From.xls")
datatable.Import("C:\Documents and
Settings\Shyam\Desktop\QTP_Script\User_Login\To.xls")
'datatable.Import("C:\Documents and
Settings\Shyam\Desktop\QTP_Script\User_Login\Agent_Name.xls"
)
'datatable.Import("C:\Documents and
Settings\Shyam\Desktop\QTP_Script\User_Login\Password.xls")
' INVOKE The Login

'datatable(2, dtGlobalSheet)= url
SystemUtil.Run(url)

'Check Login exist
if dialog("Login").Exist then
'dialog("Login").WinEdit("Agent Name:").Set DataTable
("Agent_Name", dtLocalSheet)
'dialog("Login").WinEdit("Password:").Set DataTable
("Password", dtLocalSheet)
Dialog("Login").WinEdit("Agent Name:").Set DataTable
("A",dtLocalSheet)
Dialog("Login").WinEdit("Password:").Set datatable("B",
dtLocalSheet)
dialog("Login").WinButton("OK").Click
' Check for invalid user and password
If dialog("Login").Dialog("Flight
Reservations").Exist Then
dialog("Login").Dialog("Flight
Reservations").WinButton("OK").Click
Reporter.ReportEvent
micfail,"Login","Invalid User /Pwd Check"
msgbox "Invalid User /Pwd Check"
ExitRun(0)
End If
'else if
else
Reporter.ReportEvent
micfail,"Login","Login Dialog not exists"
msgbox "Login Dialog not exists"
ExitRun(0)

end if
Reporter.ReportEvent micdone,"Login","Login Sucessfull"

' Enter the order information
window("Flight Reservation").WinButton
("Button_NewOrder").Click
window("Flight Reservation").ActiveX("MaskEdBox").Type
Datatable("Fdate")
window("Flight Reservation").WinComboBox("Fly
From:").Select Datatable



...............
Any more question mail me testingwithshyam@gmail.com

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In what occasion we can specify global sheet and action sheet?

649


what is the mail use of frame work(with detail). architecture for keyword driven frame work

1516


Did QTP prove efficient for your project? Yes or No, explain?

6222


how to convert 100 into hundred repees only and viceversa

1564


What are the different recording modes and how do they work?

703






what could go wrong with test automation?

1597


Do you know SQL? I know SQL but i don't have any experience...that's it..No more questions ...simply he said " you can leave for the day" ...guys prepare SQL Quires before attending interview in bank of america...

1415


I have created 3 actions in test action1, action2, action3 but I want run action 1,action 3,action2 how can you change in the actions in keyword view?

715


Output values? i want a practical example

1399


How many types of recording modes in qtp?

685


give me an example where u used good judgement and logic in solving a problem

3438


Explain the concept of object repository?

635


How can I open a EXCEL file from QTP Resultviewer with reporter.ReportEvent function call. Example: Test files for details click "here". And clicking "Here" in the resultviewer will open a local EXCEL FILE.

1936


Is text area check point supports for web applications?

614


What are the key elements available in test result window?

720