Share this page

# 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, after you install the IDE plugin included in OpenText Functional Testing for Developers.

In this topic:

## 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 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 command line utilities for converting OpenText Functional Testing object repositories to OpenText Functional Testing for Developers application models and OpenText Functional Testing for Developers application models to OpenText Functional Testing object repositories.

For details, see Convert object repositories to application models and Convert application models to 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. For details, see Create a new application model project and Create an application model item in an existing test project

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

2. (Optional) Modify the application model root node properties.

   Property | Description
   --- | ---
   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.

You can create a new application model or create an application model item in an existing project.

Create a new application model project

IDE | How to create an application model project
--- | ---
Visual Studio | In the New Project wizard, filter for Functional Testing For Developers and select FTD Application Model Project. Provide a name, location, and solution name and click OK.
Eclipse, Spring Tool Suite, or JBoss Developer Studio | In the New Project wizard, select Functional Testing For Developers > FTD Application Model Project and click Next. Maven project: Select Create as a Maven project. Click Next. Select a location for the project. Click Next. Provide the Maven artifact information, as well as a name for the project. Click Finish to create the project. Non-Maven project: Specify a project name, a package for the application model, and a location for the project. Click Next. Define the Java build settings. Click Finish to create project. Java 9 or later: When creating the project, clear the option Create module-info.java file. Otherwise, after the project is created, manually move the OpenText external .jar files in the Java Build Path, from Classpath to the Modulepath. For details, see Move external .jar files.
IntelliJ IDEA | Open the New Project wizard. Select Application Model and click Next. If you are creating the Application model as a Maven project, select Create as a Maven project. Click Next. Provide a name and location for the project. For a non-Maven project, provide the base package (for example, com.company) For a Maven project, provide the Maven artifact information. Click Finish to create the project. When you close the wizard, a .tsrx file is created under the src folder and a corresponding .java file is generated under appmodels. Any updates made to the .tsrx file automatically invoke a regeneration of the corresponding .java file.

Create an application model item in an existing test project

IDE | How to create an application model item
--- | ---
Visual Studio | Right-click an existing test project in your solution and select Add Functional Testing For Developers > Application Model.
Eclipse, Spring Tool Suite, or JBoss Developer Studio | Select File > New > Other > Functional Testing For Developers > FTD Application Model Item and browse to the package in the src folder where you want to add it. The item (.tsrx) is added under the package folder and a corresponding .java file is generated under the appmodels folder.
IntelliJ IDEA or Android Studio | In the project, select the folder under which you want to add the application model item (the source folder or any folder under it). Right-click the folder, select New > FTD Application Model item, and provide a name for the item. The item (.tsrx) is added under the selected folder and a corresponding .java file is generated under the appmodels folder.

Back to top

## Add test objects to the application model

You can add test objects to the application model manually, or using the Object Identification Center (OIC).

For details on adding test objects to the application model using the OIC, see Add objects to your application model.

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 OpenText Functional Testing for Developers 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 OpenText Functional Testing for Developers 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 Test-object hierarchy in the object 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 checkboxes 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

## Use application model test objects (Visual Studio)

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

1. Compile your application model project or the test project containing your application model.

2. If your application model is in a dedicated application model project, create a reference in your testing project to the application model DLL and add a using statement for the application model project. For example:

   using FTDAppModelProject4;

3. For Web, SAP GUI, or Mobile applications, or optionally for Windows-based applications: Define the parent application object that your instance of the application model will use.

   For example:

   IBrowser testBrowser = BrowserFactory.Launch(BrowserType.Chrome);

   or

   IWindow myWinApp = Desktop.Describe<IWindow>(new WindowDescription {IsChildWindow = false, WindowClassRegExp = @"CalcFrame"});

4. Instantiate the application model class.

   If you defined the parent object in your code, provide the relevant parent object as the class constructor.

   For example:

   MySite_AppModel mySiteApp = new MySite_AppModel(testBrowser);

   If your application model contains the parent object (for Windows-based objects), instantiate the application model class without a constructor.

   For example:

   MyWinApp_AppModel myAppModel = new MyWinApp_AppModel();

5. Use test objects from the application model in your tests.

   For example:

   mySiteApp.MainPage.TwitterLink.Click();

Example: This image shows an NUnit test in Visual Studio that references the hpSite_AppModel.

If you type the application model test object path manually, IntelliSense provides the available test objects at each level of the hierarchy.

Alternatively, you can right-click any test object in the Application Model editor, select Generate code to clipboard, and paste the generated test object code into your test.

Back to top

## Use application model test objects (Eclipse)

Follow the instructions for using application model test objects in your test steps, in Eclipse, Spring Tool Suite, or JBoss Developer Studio.

1. Add the application model to the Java build path of your test.

2. In your OpenText Functional Testing for Developers test, add an import line for your application model.

   For example:

   `import com.hp.lft.myAppModel;`

3. For Web, SAP GUI, or Mobile applications, or optionally for Windows-based applications: Define the parent application object that your instance of the application model will use.

   For example:

   Browser browser = BrowserFactory.launch(BrowserType.CHROME);

   or

   Window notepadWindow = Desktop.describe(Window.class, new WindowDescription.Builder().windowClassRegExp("Notepad").windowTitleRegExp(" Notepad").build());

4. Instantiate the application model class.

   If you defined the parent object in your code, provide the relevant parent object as the class constructor.

   For example:

       MySite appModel = new MySite(browser);

   If your application model contains the parent object (for Windows-based objects), instantiate the application model class without a constructor.

   For example:

   MyWinApp appModel = new MyWinApp();

5. Use test objects from the application model in your tests.

   For example:

   appModel.HomePage().LaptopsLink().click();

Example: This image shows a JUnit test in Eclipse that references the hpSite application model.

If you type the application model test object path manually in your test, IntelliSense provides the available test objects at each level of the hierarchy.

Alternatively, you can right-click any test object in the Application Model editor, select Generate code to clipboard, and paste the generated test object code into your test.

Back to top

## Use application model test objects (IntelliJ)

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

1. Add the application model to the Java build path of your test.

2. In your test, add an import line for your application model.

   For example:

   `import com.hp.lft.myAppModel;`

3. For Web, SAP GUI, or Mobile applications, or optionally for Windows-based applications: Define the parent application object that your instance of the application model will use.

   For example:

   Browser browser = BrowserFactory.launch(BrowserType.CHROME);

   or

   Window notepadWindow = Desktop.describe(Window.class, new WindowDescription.Builder().windowClassRegExp("Notepad").windowTitleRegExp(" Notepad").build());

4. Instantiate the application model class.

   If you defined the parent object in your code, provide the relevant parent object as the class constructor.

   For example:

   MyAppModel appModel = new MyAppModel(browser);

   If your application model contains the parent object (for Windows-based objects), instantiate the application model class without a constructor.

   For example:

       MyAppModel appModel = new MyAppModel();

5. Use test objects from the application model in your tests.

   For example:

   appModel.Page().Button();

This image shows an example of a JUnit test in IntelliJ IDEA that references the hpAppModel application model:

If you type the application model test object path manually in your test, IntelliSense provides the available test objects at each level of the hierarchy.

Alternatively, you can right-click any test object in the Application Model editor and select Generate code to clipboard. Then you can paste the test object code into your test.

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

IDE | How to 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 it is identified 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), OpenText Functional Testing Lab 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 OpenText Functional Testing for Developers 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 using the XML file.

- Set the color theme to light or dark:

  IDE | How to set the color theme
  --- | ---
  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:

- Test-object hierarchy in the object application model
- Generate application model code

https://admhelp.microfocus.com Functional Testing for Developers 8942
Tips to improve your search results... OpenText™ Functional Testing for Developers Help Center OpenText™ Functional Testing for Developers Help 25.2 All View Local Help Center View Online Help Center Version: