Skip to Content
Author's profile photo Former Member

QuickTest Professional “With” Statement

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.


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”
End With

Happy Coding!
Asaf Saar

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.