Automating Using QTP Day5 Some VbScripting Techniques

Synchronization of the application load with the Script execution :
Wait and WaitRoproperty.
In scenarios wherein the properties of the object changes after some time we use waitproperty.

Object Recognition Mechanism in QTP :

  • Add object in the Object Repository using Object Spy 
  • Creating the same using Descriptive programming.
  • Using the active screen or going into the application and clicking insert new object.
Regular Expression Usage Effectively in the scripting :
After having gone through the Book Ticket scenario in the Flight application . just go into the File menu for Fax order scenario.
Go to file and select Fax the booked tickets.
Select for regular expression option so that the fax order number gets recognised each time on the basis
of this very regular expression
Just put a .* after the point from where the characters is expected to be changed.

Text Checkpoint :
Checked text, Text Before, After text
Match CAse, exact match,

Text Area checkpoint
is for tabular display for any specific row.
namespace standards in xml.
XML Addins
is required for the XML checkpoints.

Test Objects used by web services.
Strat Transaction end transactionm...
Time frames get retunrned
Generally used foir query time out features related to databasae interactions.
Colon is used to combine multiple statement in one line

Important conecpts in Advanced QTP workaround :

  • Parameterization
  • Checkpoint
  • Synchronization
  • Object Repository
Descriptive Programming  is a technique used when an object property changes frequently.
No Object Repository method is used for object identification.

Static are the necessary properties of an objects.
Methods like SET are used for creating references to the objects actually present in the application.

Let us look into describing the Objects in the application. Do remember the hierarchy of the Parent and child objects. Generally  the approach we follow for the description programming  is coding in the hierarchial manner that an object is recognized by the QTP tool during the course of object identification.

 Login Box Which is a dialog box
 Keep your appplication open, Object Spy tool can be useed to spy onto the objects and highlight and  copy the properties of the required objects.
 Individually search for each of the objects associated properties.
 Always use the two things, class name and the text name genuinely very relevant.

 Below we spy for the Login dialog page properties

Parent Objects :
Set oLogin=Description.Create()oLogin("Class Name").Value="Dialog"
oLogin("text").Value="Login"

 Child Objects :
 For Login Fileds Textbox

Set oUserNam=Description.Create() oUserNam("Class Name").Value="WinEdit"
 oUserNam("attached text").Value="Agent Name:"

 For Password Fields Textbox Set opassword=Description.Create()
 opassword("Class Name").Value="WinEdit"
 opassword("attached text").Value="Password:"

For Button to log on OKSet oOKButton=Description.Create() oOKButton("Class Name").Value="WinButton"
oOKButton("text").Value="OK"

 For Button to log on CancelSet oCanButton=Description.Create() oCanButton("Class Name").Value="WinButton"
oCanButton("text").Value="Cancel"

 Now , let us code using VBScript  to execute the events in the application which is expected to be performed for logging into the application.

InvokeApplication
"D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight3a"
Dialog(oLogin).WinEdit(oUserNam).Type"employee"
Dialog(oLogin).WinEdit(oUserNam).Set "employee"
Dialog(oLogin).WinEdit(oPassword).Set "mercury"
Dialog(oLogin).WinButton(oOKButton).Click


Dynamic Descriptive programming :
InvokeApplication  "D:\Program Files\HP\QuickTest Professional\samples\flight\app\flight3a"
Dialog("Class Name:= Dialog","text:=Login").Winedit("Class Name:=WinEdit","attached text:=Agent Name:").Set "2039"
Dialog("Class Name:= Dialog","text:=Login").Winedit("Class Name:=WinEdit","attached text:=Password:").Setsecure "4ceb5e5216db248fd801b9d8e2364301e4bafec6"


This is how we do descriptive programming to automate the stable working features of an application. Do always take care of the hierarchy of the application.

0 comments:

Post a Comment