Application models

An application model is an abstraction, or model, of the application you are testing.

Application models are available with Trial and Design-type licenses.

Overview

An application model is comprised of a hierarchy of test objects that correspond to the structure of the actual objects in your AUT or a specific area of the AUT.

When you create a new UFT Developer application model, two files are created:

  • .tsrx . An XML representation of the application model and its objects.

    This file is created when you create the application model item or project, and is updated regularly when you add test objects to your application model (using the Object Identification Center, in the Application Model editor, or directly in the file itself).

  • .tsrx.cs or .java. A file containing the code for the application model class.

    Each application model is compiled into a class that can be instantiated in your test, enabling you to access the complete test object model of your application.

    This file is generated from the .tsrx file. There are several ways to generate this file, as described in Generate application model code.

Using the application model enables you to maintain your test objects in a single location for use across your entire testing suite, and helps you write your code more quickly, without the need to write manual programmatic descriptions for each object.

Tip: Use our command line utilities for converting UFT object repositories to UFT Developer application models and UFT Developer application models to UFT object repositories.

For details, see Convert UFT object repositories to UFT Developer application models and Convert UFT Developer application models to UFT object repositories.

Back to top

Create an application model

  1. You can create an application model as a dedicated application model project or as a class within the context of an existing project.

    Note: Do not add a UFT Developer test file inside a UFT Developer application model project. The project will not compile.

  2. (Optional) Modify the Application Model root node properties.

    Name

    The display name of the root node in the main Application Model window.

    Class Name

    Visual Studio only. The name of the class that is generated for your application model. This is the class you use in your tests.

    Eclipse, Spring Tool Suite, JBoss Developer Studio, IntelliJ IDEA. the application model .tsrx file acts as the application model class name. . To change the application model class name, rename the .tsrx file.

    Description A description of the application or application area this model represents, or any other detail you want to provide.

Back to top

Define test objects manually in the Application Model editor

You can manually define test objects in the Application Model. This is useful if you want to begin preparing your testing infrastructure before or while the application is being developed.

  1. Ensure that UFT Developer is enabled.

  2. Create or open an application model.

  3. In the Application Model editor toolbar, click the Create new test object button and provide the required details in the New Object pane. The code name is the name that you use to reference the object in your test code.

    You can also optionally provide a detailed description and upload a screen capture image.

    Note: You can create test objects in your application model for any technology object interface provided in the UFT Developer SDK, except IBrowser (C#) or Browser (Java). When working with Web-based applications, your IBrowser / Browser test object must be created in your test code and passed to the application model class instance as the context for the application model. For more information, see About the test object hierarchy in the application model.

  4. In the Identification section, click All (displayed by default) to view the supported properties for the object type you selected.

  5. Select the check boxes of the properties you want to use to uniquely identify your object, and enter the relevant values for each. After you select a set of properties, you can view them together in the Used view.

    To view the recommended properties for a test object and to see the current values of those properties for the object in your application, use the Object Identification Center (OIC).

    To enter regular expression values for string properties, click the Set as RegEx star to the right of the value box.

    • Specify regular expressions using VBScript regular expression syntax. For example, to indicate any number of characters in a string, use .* and not just the * expression.

    • Regular expressions are not supported for Mobile test objects.
  6. Click the Save button at the top of the New Object pane to save your changes and add the new object to the Application Model.

    Note for Eclipse, Spring Tool Suite, or JBoss Developer Studio users on Mac: To save your changes using Command+S you must move the focus outside of the Application Model editor.

Back to top

Add test objects to the application model using the Object Identification Center

Use the Object Identification Center (OIC) to add objects to your application model. For details, see Add objects to your application model.

Back to top

Use application model test objects in your test steps

Follow the instructions for using application model test objects in your test steps.

Back to top

Manage large application models

When you have a large number of test objects in your application model, it can be difficult to find the object you need, or to check whether an object already exists just by skimming. You can use the following functionalities:

Feature Details
Tags

You can add tags to test objects to categorize them. You can then filter your test objects by tag using the Advanced Search.

When you add test objects from the OIC, you can create tags for the object before you add it.

Search

You can search for objects in the Search box, or click the Advanced button to filter by object name, code name, object type, properties, or tags.

The search is not case sensitive.

Locate using the OIC

If you are not sure whether a test object already exists in your application model, open the OIC from the Application Model editor.  Spy on the relevant object in your application and then use the Locate Object in Application Model button.

You may need to switch to Edit mode and adjust the selected objects in the hierarchy or the selected properties to match the test object as it was saved in your application model.

Back to top

Application Model editor functionality

Switch between the Application Model editor and the XML code

Visual Studio

Right-click the Application Model .tsrx file in the Solution Explorer and select View Code or View Designer.

Note: In some cases, the F7 and Shift-F7 shortcut keys do not work.

Eclipse, Spring Tool Suite, or JBoss Developer Studio

Use the Design and Source tabs at the bottom of the .tsrx window.

IntelliJ IDEA

Use the Designer and Text tabs at the bottom of the .tsrx window.

  • You can edit the application model in the editor or in the XML file. The other display is updated when you save the file.

  • If you modified the application model (whether inside your IDE or in an external editor) and the changes were not synchronized to the generated code, refresh the project, open the application model inside your IDE, and rebuild the project.

  • Eclipse, Spring Tool Suite, or JBoss Developer Studio users on Mac: To save your changes using Command+S you must move the focus outside of the Application Model editor.

Other Application Model editor functionality

  • Highlight the object in your application that corresponds to your test object, to check that UFT Developer identifies it as expected. Before you click the Highlight button, make sure your application is open and is displaying the object you want to highlight.

    If more than one browser (including mobile browsers), UFT Mobile remote access window, or SAP GUI session window is open the first time you select to highlight a Web-based, Mobile, or SAP GUI object during an application model session, a small window prompts you to select the target application for the highlight. That window is saved as the target application for the remainder of the UFT Developer session.

    If you want to highlight objects in a different window, use the pull-down arrow next to the Highlight button and select Change to open the target application window.

  • Perform basic editing options such as Copy, cut, paste, delete, undo/redo, as well as the option to drag and drop test objects within the Application Model.

  • Add Visual Relation Identifiers to your test object descriptions.  For details, see Use Visual Relation Identifiers (VRIs).

  • Edit application models via the XML file.
  • Set the color theme to light or dark:

    Visual Studio / IntelliJ IDEA

    The application model inherits the color theme defined in Visual Studio.

    Eclipse, Spring Tool Suite, or JBoss Developer Studio

    In a text editor, open

    • Win: %localappdata%\LeanFT\Preferences\EclipsePluginPreferences.json
    • Linux: ~/.leanft/preferences/EclipsePluginPreferences.json
    • Mac: ~/Library/Application Support/LeanFT/Preferences/EclipsePluginPreferences.json

    In the line below, set the theme as "LIGHT" or "DARK":

    {"disablePlugin":false, "theme": "LIGHT"}

Back to top

See also: