One Testing Center

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center - QC.

QTP - Frameworks

QTP - Frameworks. Record and Play back Framework. Action Driven Framework. Data Driven Framework. Functional Decomposition Framework. Keyword Driven Framework. Hybrid Framework. Test Driven Framework.

QTP - Automation

QTP - Basics. QTP - Intermediate. QTP - Advanced. QTP - Frameworks.

QTP - Training

Friends, Welcome to OneTestingCenter. I am HP Functional Test ExportOne. I am HP Automation Functional Test Certified Professional. I am certified for HP Functional Test 11.x. Happy to share my knowledge.

QTP - Books

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center.

Recent Post

QTP @ MsgBox


MsgBox – Message Box

  • MsgBox
  • MsgBox(prompt, buttons, title, helpfile, context)
  • Prompt : The text of the message to display in the message box dialog.
  • Buttons :The sum of the Button, Icon, Default Button, and Modality constant values.
  • Title : The title displayed in the Title-bar of the message box dialog.
  • Helpfile :An expression specifying the name of the help file to provide help functionality for the dialog.
  • Context : An expression specifying a context ID within helpfile.


MSGBOX – Buttons

Constant
Value
Description
vbOKOnly
0
Display OK button only.
vbOKCancel
1
Display OK and Cancel buttons.
vbAbortRetryIgnore
2
Display Abort, Retry, and Ignorebuttons.
vbYesNoCancel
3
Display Yes, No, and Cancel buttons.
vbYesNo
4
Display Yes and No buttons.
vbRetryCancel
5
Display Retry and Cancel buttons.
vbCritical
16
Display Critical Message icon.
vbQuestion
32
Display Warning Query icon.
vbExclamation
48
Display Warning Message icon.
vbInformation
64
Display Information Message icon.
vbDefaultButton1
0
First button is default.
vbDefaultButton2
256
Second button is default.
vbDefaultButton3
512
Third button is default.
vbDefaultButton4
768
Fourth button is default.
vbApplicationModal
0
Application modal; the user must respond to the message box before continuing work in the current application.
vbSystemModal
4096
System modal; all applications are suspended until the user responds to the message box.

MSGBOX – Return values

Constant
Value
Button
vbOK
1
OK
vbCancel
2
Cancel
vbAbort
3
Abort
vbRetry
4
Retry
vbIgnore
5
Ignore
vbYes
6
Yes
vbNo
7
No




Msgbox – demo

ž  Example:
      sMsg = "This is line 1" & vbNewLine & "This is line 2"
      MsgBox sMsg
      MsgBox "Hahaha...I am just laughing..Just like that :):)"
     
      MsgBox "Hahaha...I am just laughing.." & vbNewLine & "Just like that :):)“
      MsgBox ("All Done")
MyVar = MsgBox ("Hello Friend",0, "QuickTest QTP @ GAReddy")
MsgBox MyVar
MyVar = MsgBox ("Are you really interested?",3, "QuickTest QTP @ GAReddy")
MsgBox MyVar

'vbYesNoCancel

MyVar = MsgBox ("Are you really interested?",vbYesNoCancel, "QuickTest QTP @ GAReddy")
MsgBox MyVar
  • var=MsgBox("Hiiiiiiiiiii",4,"GAReddy")
  • msgbox var
  • MyVar = MsgBox ("Hello Friend",0, "QuickTest QTP @ GAReddy")
  • MsgBox MyVar
  • MyVar = MsgBox ("Are you really interested?",3, "QuickTest QTP @ GAReddy")
  • MsgBox MyVar
o   'vbYesNoCancel
o   MyVar = MsgBox ("Are you really interested?",vbYesNoCancel, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",256, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",512, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",768, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",0, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",4096, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",64, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar
o   MyVar = MsgBox ("Are you really interested?",48, "QuickTest QTP @ GAReddy")
o   MsgBox MyVar

QTP @ InputBox


  • InputBox Function
    • The InputBox function displays a dialog box containing a label, which prompts the user about the data you expect them to input, a text box for entering the data, an OK button, a Cancel button, and optionally, a Help button. When the user clicks OK, the function returns the contents of the text box.
  • InputBox(Prompt, Title, Default, Xpos, Ypos, HelpFile, Context)
  •   MsgBox Function
    • Displays a dialog box containing a message, buttons, and optional icon to the user. The action taken by the user is returned by the function as an integer value.
o   InPutBox
  • Syntax
  • InputBox(prompt,title,default,xpos, ypos, helpfile, context)
  • Description
  • Prompt: The message in the dialog box.
  • Title :The title-bar of the dialog box.
  • Default : String to be displayed in the text box on loading.
  • Xpos : The distance from the left side of the screen to the left side of the dialog.
  • Ypos : The distance from the top of the screen to the top of the dialog box.
  • Helpfile : The Help file to use if the user clicks the Help button on the dialog box.
  • Context : The context number to use within the Help file specified in helpfile.

o   InputBox - demo
  • Example:
o   YourName=InputBox("What's Your Name","Name Box", "MyName")
o   MsgBox YourName
o   MyAddress = InputBox("Enter your Address", , "Something", , , "help.hlp", 321321)
o   MsgBox MyAddress

  • Example:
o   Option Explicit
o   Dim sPrompt, sTitle, sHelpFile, sRes
o   Dim vDef
o   Dim nYPos, nXPos, nContext
o   sPrompt = "Where do you live?" : sTitle = "Personal Data"
o   vDef = "INDIA"
o   nXPos = 100 : nYPos = 100 : nContext = 1001
o   sHelpFile = "C:\WINDOWS\system32\winhelp.hlp"
o   sRes = InputBox(sPrompt, sTitle, vDef, nXPos, nYPos, sHelpFile, nContext)
o   MsgBox sRes

QTP @ Synchronization @ Script Demo


QTP @ Synchronization @ Script Demo

'*******************************************
'QTP @ Synchronization @ Script Demo
'*******************************************

'********************************************
'QTP @ Synchronization > Wait Method Demo
'********************************************
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
wait(2)

'********************************************
'QTP @ Synchronization > WaitProperty Method Demo
'********************************************
LoginExist=Dialog("Login").WaitProperty("enabled",10): msgbox "LoginExist" & LoginExist

'********************************************
'QTP @ Synchronization > Exist Method Demo
'********************************************
If Dialog("Login").Exist Then
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "QuickTest"
Dialog("Login").WinEdit("Agent Name:").Type  micTab
Dialog("Login").WinEdit("Password:").SetSecure "4cff4da856c61fe63bc04099938e4b492de78365"
Dialog("Login").WinButton("OK").Click
wait(5)
'********************************************
'QTP @ Synchronization > WaitProperty Method Demo
'********************************************
st1=Window("Flight Reservation").WaitProperty ("visible",true,1500000)
MsgBox st1
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"
else
MsgBox " Nothing I can do here"

End If


QTP @ Synchronization

QTP @ Synchronization

Synchronization:

Synchronizing is the process of utilizing time lines / time periods until for a specific purpose

When you run tests, your application may not always respond with the same speed.
For example, it might take a few seconds:
  •       For a progress bar to reach 100%
  •       For a button to become enabled
  •       For a button to become disabled
  •       For a window or pop-up message to open
You can handle these anticipated timing problems by synchronizing your test to ensure that QuickTest waits until your application is ready before performing a certain step

Synchronization - Ways to synchronize the test

There are several options that you can use to synchronize your test:
  We can insert a synchronization point, which instructs
    QuickTest to pause the test until an object property achieves the value you specify. QTP -> Insert > Synchronization Point
  We can use Sync method to utilize the synchronization until for a specific time
  We can insert Exist statements that instruct QuickTest to wait until an object exists
  We can use Wait to wait a specified amount of time before continuing the test.
  You can also use Waitproperty(“propertyname”)
  You can also increase the default Timeout settings in the Test Settings and Options dialog boxes in order to instruct QuickTest to allow more time for certain events to occur.
  QTP -> File > Settings > Run > Synchronization timeout

Synchronization – Methods

Wait(WaitTime)
Wait(10)
WaitProperty “PropertyName”,”PropertyValue”, Time
Dialog("Login").WaitProperty "enabled",true,10
Exist
If Dialog("Login").Exist Then
Dialog("Login").Close
End If
Sync
Browser("Welcome: Mercury Tours").Page("Page").Sync

GAReddy @ OneTestingCenter @ All Articles