Application models

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

Note: Available with Trial and Design-type licenses.

The Basics

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 LeanFT application model, two files are created: A .tsrx file that can display the Application Model editor as a rich user interface or as an XML file, and a tsrx.cs 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.

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: You can use the OR2AppModelConverter.exe command line utility to convert existing UFT object repositories to LeanFT application models. For details, see Convert UFT object repositories to LeanFT application models.

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 LeanFT test file inside a LeanFT 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/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.

Note: Ensure that LeanFT is enabled.

  1. Create or open an application model.

  2. 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 LeanFT 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.

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

  4. 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.

    Note:  

    • 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.
  5. 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 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 (OIC)

The OIC enables you to capture the current details of any object in your application. You can optionally modify the set of properties used for the description or modify the description values, and you can add the defined test object and parent test objects if needed, to your application model.

You can also select to add a test object and all or selected child test objects simultaneously (Windows only).

For details, see:

Back to top

Use 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

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 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 LeanFT 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.

    Note: If more than one browser, Mobile Center 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 LeanFT 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 (VRI).

  • 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

    In a text editor, open

    • Win: %localappdata%\Hewlett-Packard\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: