UFT One Automation Object Model Overview

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

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

Automation scripts are especially useful for performing the same tasks multiple times or on multiple tests or components, or for quickly configuring UFT One 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.

What is the UFT One 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 One 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 One interface. Although a one-on-one comparison cannot always be made, most dialog boxes in UFT One 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 One 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 One 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

    UFT One 15.0.1 and later: You can skip this step if the script will only open existing tests or business components and run them. When opening a test or business component, UFT One dynamically loads its associated add-ins. For details, see the topic on working with add-ins in the UFT One Help Center.

  • Starts UFT One 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 One with specific configuration settings. You can then instruct all of your testers to open UFT One using this automation script to ensure that all of your testers are always working with the same configuration.