Thursday, August 2, 2012

Why GetROproperty,GetTOProperties and SetTOProperty

*************************************************************************
GetRoProperty:
*************************************************************************
    To get  the Runtime object propertie values

Example:

'In flght reservation application while inserting order,Order Number will get generated at runtime
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"
Window("Flight Reservation").WinButton("Insert Order").Click
Wait 4
vOrderNumber = Window("Flight Reservation").WinEdit("Order No:").GetRoProperty("value")
 *************************************************************************
GetTOProperties :
*************************************************************************

                   We can get the property values of test objects,i.e For QTP which properties are helpful to identify the object 

Example:

  
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "QTP User"

msgbox Window("Flight Reservation").WinEdit("Name:").GetTOProperties ("name")
*************************************************************************

SetTOProperty:
*************************************************************************

             We can Modify the object property values at run time

Example:

r.Activate

Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly From:").SetTOProperty “attached text”, “Fly To:”
Window("Flight Reservation").WinComboBox("Fly From:").Select "Los Angeles"


Note:Here we don't need to add FlyTo object to OR











Reporter Object in QTP


*********************************************************************************
 ReporterObject:
*********************************************************************************

Using Repoter object we can send the customize results QTP result window

Below are the methods to work with Repoter object

• ReportEvent Method

• Filter Property

• ReportPath Property

• RunStatus Property

*********************************************************************************
ReportEvent Method:
*********************************************************************************

ReportEvent Method is used to send the user events to result  window

Syntax:
Reporter.ReportEvent EventStatus, ReportStepName, Details     For Reporterevent we need Pass the  three argumrnts
 1)EventStatus (Micpass,MicFail,micDone,micWarning)
 2)ReportStepName : Executing StepName
3)Details  := Description  about the  ReportStepName   ********************************************************************************
 Filter Property:

*********************************************************************************       
 By using Filter property we can filter the Eventstatus of the result window

  Example: Reporter.Filter = mode  

Modes:
 micPass
 micFail
micWarning
micDone    

If  mode is micPass it will filter the all passed steps 

 *********************************************************************************
ReportPath Property:
*********************************************************************************

Msgbox Reporter.ReportPath
It will give the path of result stored location
  *********************************************************************************
RunStatus Property:
*********************************************************************************  
Msgbox  Reporter.RunStatus
 It returns the status of current test during the test run.