Descriptive Programming in UFT

Please refer the below video, it covers basics of DP, How to use DP, Practical Examples of DP, Types of DP , Limitations of DP.

What is DP?

  •  Descriptive programming 
  •  Smart way of automation testing in UFT



  Where to Use?

  •  Objects in application are dynamic 
  •  OR size is increasing
  •  Don’t want to use OR
  •  OR is in read only mode 
  • Working with similar type of objects



Static DP?

  • Object information is send directly into the script
  •  “PropertyName” :=“Property Value” Pairs
  •  Browser(“creationTime:=0”).click



  Dynamic DP?

  • Description object to return a properties collection 
  • Set obj = description.create 
  • obj(“PN”).Value = “PV” 
  • Browser(obj).click



Usage Constraint 

  • When using DP from a specific point within a test object hierarchy, you must continue to use programmatic descriptions from that point onward within the same statement 

                Window(“Calculator”).WinButton(“Window Id:=2”).click (Correct)
                Window(“Window id:=123”).WinButton(“2”).click (Wrong)

  •  Property objects added to a Properties collection are treated as regular expressions.


Meaning of DP in UFT
Example1
Example2
Example3

One thought on “Descriptive Programming in UFT

  1. '1 “UFT Dynamic Descriptive Program for Click on OK Cancel and Help Button ”
    SystemUtil.Run"C:Program Files (x86)HPUnified Functional Testingsamplesflightappflight4a.exe"
    Set DesObj=Description.Create
    Set DesObjCh=Dialog("text:=Login").ChildObjects(DesObj)
    msgbox DesObjCh.Count
    DesObj("nativeclass").Value="Button"
    Set DesObjCh=Dialog("text:=Login").ChildObjects(DesObj)
    msgbox DesObjCh.Count
    For i = 1 to DesObjCh.Count
    Dialog("text:=Login").Activate
    Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "Nilesh"
    Dialog("text:=Login").WinEdit("attached text:=Password:").Set "mercury"
    If i=1 Then
    dialog("text:=Login").WinButton("text:=OK").Click
    window("text:=Flight Reservation").Activate
    Window("text:=Flight Reservation").winedit("acx_name:=MaskEdBox").Set "12/12/15"
    window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").Select "Denver"
    window("text:=Flight Reservation").WinComboBox("attached text:=Fly To:").Select "London"
    window("text:=Flight Reservation").WinButton("text:=Flight").Click
    Window("text:=Flight Reservation").dialog("regexpwndtitle:=Flights Table").WinButton("text:=OK").Click
    window("text:=Flight Reservation").winedit("window id:=1014").Set "Nilesh Banjare"
    window("text:=Flight Reservation"). winButton("text:=&Insert Order").click
    Window("text:=Flight Reservation").Close
    Systemutil.Run"C:Program Files (x86)HPUnified Functional Testingsamplesflightappflight4a.exe"
    ElseIf i=2 Then
    Dialog("text:=Login").WinButton("text:=Cancel").Click
    Systemutil.Run"C:Program Files (x86)HPUnified Functional Testingsamplesflightappflight4a.exe"
    elseif i=3 Then
    dialog("text:=Login").WinButton("text:=Help").Click
    End If
    Next

    Thanks,
    Nilesh Banjare

Leave a Reply

Your email address will not be published. Required fields are marked *