UFT Automation Scripts

Relevant for: GUI tests and components

You can use the UFT automation object model to write scripts that automate your UFT operations. The UFT automation object model provides objects, methods, and properties that enable you to control UFT from another application.

Using the objects, methods, and properties exposed by the UFT automation object model, you can write scripts that configure UFT options and run tests or components instead of performing these operations manually using the UFT interface.

Automation scripts are especially useful for performing the same tasks multiple times or on multiple tests or components, or for quickly configuring UFT according to your needs for a particular environment or application.

What is Automation?

Automation is a Microsoft technology that makes it possible to access software objects inside one application from other applications. These objects can be created and manipulated using a scripting or programming language such as VBScript or VC++. Automation enables you to control the functionality of an application programmatically.

Back to top

What is the UFT Automation Object Model?

An object model is a structural representation of software objects (classes) that comprise the implementation of a system or application. An object model defines a set of classes and interfaces, together with their properties, methods and events, and their relationships.

The UFT automation object model is a set of objects, methods, and properties that enable you to control essentially all of the configuration and run functionality provided via the UFT interface. Although a one-on-one comparison cannot always be made, most dialog boxes in UFT have a corresponding automation object, most options in dialog boxes can be set and/or retrieved using the corresponding object property, and most menu commands and other operations have corresponding automation methods.

You can use the objects, methods, and properties exposed by the UFT automation object model, along with standard programming elements such as loops and conditional statements to design your script.

Automation scripts are especially useful for performing the same tasks multiple times or on multiple tests or components, or for quickly configuring UFT according to your needs for a particular environment or application.

Example: You can create and run an automation script from Microsoft Visual Basic that does the following:

  • Loads the required add-ins for a test or component

  • Starts UFT in visible mode

  • Opens the test or component

  • Configures settings that correspond to those in the:

    • Options dialog box

    • Test Settings or Business Component Settings dialog box

    • Record and Run Settings dialog box (tests only)

  • Runs the test or component

  • Saves the test or component

You can then add a simple loop to your script so that your single script can perform the operations described above for multiple tests or components.

You can also create an initialization script that opens UFT with specific configuration settings. You can then instruct all of your testers to open UFT using this automation script to ensure that all of your testers are always working with the same configuration.

Back to top