Saturday, 5 February 2011

QTP @ Synchronization

Leave a Comment
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
Read More...

QTP @ SetTOProperty Script Demo

Leave a Comment
Read More...

QTP @ GetTOProperty Script Demo

Leave a Comment
Read More...

QTP @ GetTOProperties Script Demo

Leave a Comment
Read More...

QTP @ GetTOProperties / GetTOProperty / SetTOProperty Demo

Leave a Comment


QTP @ GetTOProperties / GetTOProperty / SetTOProperty Demo


SystemUtil.Run "http://newtours.demoaut.com/"
wait(2)

'*******************************************
' Demo for the GetTOProperties()
'********************************************
'Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName")
Set MyEditProps=Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperties()
For i= 0 to MyEditProps.count-1
       strPropertyName=MyEditProps(i).Name
       strPropertyValue=MyEditProps(i).Value
       MsgBox "strPropertyName" &vbTab& strPropertyName &vbTab& "strPropertyValue"&vbTab& strPropertyValue
Next

'*******************************************
' Demo for the GetTOProperty()
'********************************************
MsgBox "Current Text of username:" &vbTab& (Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperty("text"))

Msgbox " Now I am assinging a new text value to the text property of the username"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").SetTOProperty "text","QuickTestQTP"
MsgBox "After Changing >> Current Text of username:" &vbTab& (Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperty("text"))

Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "GAReddy"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "PWD"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 16,5
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Link("Home").Click
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours_2").Link("SIGN-OFF").Click

'*******************************************
' Demo for the GetTOProperties()
'********************************************
Set MyLinkProps=Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Link("Home").GetTOProperties()
For i= 0 to MyLinkProps.count-1
       strPropertyName=MyLinkProps(i).Name
       strPropertyValue=MyLinkProps(i).Value
       MsgBox "strPropertyName" &vbTab& strPropertyName &vbTab& "strPropertyValue"&vbTab& strPropertyValue
Next

Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Link("Home").Click


Read More...

QTP @ Recording Modes

Leave a Comment

QTP @ Recording Modes

Recording Modes
Recording Usage
Description
Normal Recording
Default Recording
 It’s the default recording mode
 Records AUT – Objects and Operations made on them
Context Recording
Objects could be like:
Browser(“”), Page(“”), WinEdit(“”), WinButton(“”)
Operations could be:
Set, Click, Activate, Type
Analog Recording
Coordinate based Recording
It enables you to record the exact mouse and keyboard operations you perform in relation to the screen (Co-ordinates).
Records exact mouse and key board movements.
Records every move of the mouse
Used while recording movements that cannot be recorded at object level
Screen: Desktop.RunAnalog "Track1”
Window Based Recording
It enables you to record the exact mouse and keyboard operations you perform in relation to the application window.
Window : Window("Microsoft Internet Explorer").RunAnalog "Track2”
Low Level Recording
Window
Records on any object whether or not QTP identifies those objects
Records all run-time objects as Window or WinObject
WinObject
Use while
If Objects are not recognized by QTP
If Exact object co-ordinates are important in test

Read More...

QTP @ Objects Classifications

Leave a Comment
QTP @ Objects Classifications

Object:
·         An Object is the one which exists.
·         Objects are identified by their logical names and physical descriptions.
·         With respect to any Web Applications, Objects are like Browser, Page, Frame, Table, Image, Text, WebButton, WebEdit, WebList and so on.

Test Object
·         Test Objects are those objects which are identified, captured and stored in the QTP's Object Repository (OR) by means of their logical names and physical descriptions
·         Logical names and Physical descriptions are meaning by objects names and their properties)
·         And these Test Objects are either manually added to QTP's Object Repository or they are indentified, captured and stored during recording time.
·         These Test Objects properties are retrieved and manipulated by GetTOProperties / GetTOProperrty / SetTOProperty methods
·         GetTOProperties / GetTOProperrty / SetTOProperty methods deal with QTP’s Object Repository > Objects properties / descriptions

Runtime Objects
·         Runtime Objects are those objects which resemble the Test Objects but then they may or may not change their properties during execution time ( RunTime)
·         QTP, during execution time / RunTime, uses the Test Objects properties (which are stored in QTP’s Object Repository) to identify them and to perform the methods / operations on them.
·         Objects descriptions / Properties are like : Class, Name, Text, Type, Value and so on.
·         Methods / Operations are like: Click, Activate, Set, SetSecure,
·         These RunTime Objects properties are retrieved by GetROProperty method
·         GetROProperty method deals with the AUT > Objects at the RunTime only.


Test Objects & their properties
·         Test Object  and their properties are identified , captured and stored in QTP's Object Repository at Recording time
·         QTP stores Object as Test Object, determining the class it fits.
·         For each test object class, QTP learns a list of mandatory properties.
·         Checks if the description learnt is enough to uniquely identify the object.
·         If it is not, QuickTest adds assistive properties, one by one, to the description until it has a unique description.
·         If, in case, these properties are not sufficient to indentify an object, then QTP  takes the additional Index or Coordinate properties to identify the objects
·         And, by incase, if QTP fails by all the way using above mechanism to identify the objects then the last trial is through the QTP’s sixth sense, called as Smart Identification.


Run Time Objects & their properties
·         Searches for a run-time object that exactly matches the description of the test object
·         It expects to find a perfect match for both the mandatory and any assistive properties of test object
·         Uses Smart Identification mechanism to identify an object, if the recorded description is not sufficient or not accurate.

Read More...

Saturday, 5 February 2011

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

QTP @ SetTOProperty Script Demo

QTP @ GetTOProperty Script Demo

QTP @ GetTOProperties Script Demo

QTP @ GetTOProperties / GetTOProperty / SetTOProperty Demo



QTP @ GetTOProperties / GetTOProperty / SetTOProperty Demo


SystemUtil.Run "http://newtours.demoaut.com/"
wait(2)

'*******************************************
' Demo for the GetTOProperties()
'********************************************
'Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName")
Set MyEditProps=Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperties()
For i= 0 to MyEditProps.count-1
       strPropertyName=MyEditProps(i).Name
       strPropertyValue=MyEditProps(i).Value
       MsgBox "strPropertyName" &vbTab& strPropertyName &vbTab& "strPropertyValue"&vbTab& strPropertyValue
Next

'*******************************************
' Demo for the GetTOProperty()
'********************************************
MsgBox "Current Text of username:" &vbTab& (Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperty("text"))

Msgbox " Now I am assinging a new text value to the text property of the username"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").SetTOProperty "text","QuickTestQTP"
MsgBox "After Changing >> Current Text of username:" &vbTab& (Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").GetTOProperty("text"))

Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "GAReddy"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "PWD"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 16,5
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Link("Home").Click
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours_2").Link("SIGN-OFF").Click

'*******************************************
' Demo for the GetTOProperties()
'********************************************
Set MyLinkProps=Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Link("Home").GetTOProperties()
For i= 0 to MyLinkProps.count-1
       strPropertyName=MyLinkProps(i).Name
       strPropertyValue=MyLinkProps(i).Value
       MsgBox "strPropertyName" &vbTab& strPropertyName &vbTab& "strPropertyValue"&vbTab& strPropertyValue
Next

Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Link("Home").Click


QTP @ Recording Modes


QTP @ Recording Modes

Recording Modes
Recording Usage
Description
Normal Recording
Default Recording
 It’s the default recording mode
 Records AUT – Objects and Operations made on them
Context Recording
Objects could be like:
Browser(“”), Page(“”), WinEdit(“”), WinButton(“”)
Operations could be:
Set, Click, Activate, Type
Analog Recording
Coordinate based Recording
It enables you to record the exact mouse and keyboard operations you perform in relation to the screen (Co-ordinates).
Records exact mouse and key board movements.
Records every move of the mouse
Used while recording movements that cannot be recorded at object level
Screen: Desktop.RunAnalog "Track1”
Window Based Recording
It enables you to record the exact mouse and keyboard operations you perform in relation to the application window.
Window : Window("Microsoft Internet Explorer").RunAnalog "Track2”
Low Level Recording
Window
Records on any object whether or not QTP identifies those objects
Records all run-time objects as Window or WinObject
WinObject
Use while
If Objects are not recognized by QTP
If Exact object co-ordinates are important in test

QTP @ Objects Classifications

QTP @ Objects Classifications

Object:
·         An Object is the one which exists.
·         Objects are identified by their logical names and physical descriptions.
·         With respect to any Web Applications, Objects are like Browser, Page, Frame, Table, Image, Text, WebButton, WebEdit, WebList and so on.

Test Object
·         Test Objects are those objects which are identified, captured and stored in the QTP's Object Repository (OR) by means of their logical names and physical descriptions
·         Logical names and Physical descriptions are meaning by objects names and their properties)
·         And these Test Objects are either manually added to QTP's Object Repository or they are indentified, captured and stored during recording time.
·         These Test Objects properties are retrieved and manipulated by GetTOProperties / GetTOProperrty / SetTOProperty methods
·         GetTOProperties / GetTOProperrty / SetTOProperty methods deal with QTP’s Object Repository > Objects properties / descriptions

Runtime Objects
·         Runtime Objects are those objects which resemble the Test Objects but then they may or may not change their properties during execution time ( RunTime)
·         QTP, during execution time / RunTime, uses the Test Objects properties (which are stored in QTP’s Object Repository) to identify them and to perform the methods / operations on them.
·         Objects descriptions / Properties are like : Class, Name, Text, Type, Value and so on.
·         Methods / Operations are like: Click, Activate, Set, SetSecure,
·         These RunTime Objects properties are retrieved by GetROProperty method
·         GetROProperty method deals with the AUT > Objects at the RunTime only.


Test Objects & their properties
·         Test Object  and their properties are identified , captured and stored in QTP's Object Repository at Recording time
·         QTP stores Object as Test Object, determining the class it fits.
·         For each test object class, QTP learns a list of mandatory properties.
·         Checks if the description learnt is enough to uniquely identify the object.
·         If it is not, QuickTest adds assistive properties, one by one, to the description until it has a unique description.
·         If, in case, these properties are not sufficient to indentify an object, then QTP  takes the additional Index or Coordinate properties to identify the objects
·         And, by incase, if QTP fails by all the way using above mechanism to identify the objects then the last trial is through the QTP’s sixth sense, called as Smart Identification.


Run Time Objects & their properties
·         Searches for a run-time object that exactly matches the description of the test object
·         It expects to find a perfect match for both the mandatory and any assistive properties of test object
·         Uses Smart Identification mechanism to identify an object, if the recorded description is not sufficient or not accurate.