Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
QuickTest Professional (Mercury's functional and regression test automation tool) uses VBScript as its scripting language.
One cool feature of QuickTest (a.k.a QTP) is the “With” Statement.

With statement allows you to perform a series of statements on a specified object without re-qualifying the name of the object. With statements make your script more concise and easier to read and write or edit by grouping consecutive statements with the same parent hierarchy.

Example:

You can replace this script:
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click

With the following:
With Window("Flight Reservation")
   .WinComboBox("Fly From:").Select "London"
   .WinComboBox("Fly To:").Select "Los Angeles"
   .WinButton("FLIGHT").Click
End With


Happy Coding!
Asaf Saar