LeanFT Tutorial #4: Application Model Overview

6
277
Application Model

In this post we are going to focus on Application Model in LeanFT. Refer our earlier posts on LeanFT

Getting Ready with LeanFT

Browser Extensions and Settings

Object Identification Center

Important update for everyone: HPE UFT and HPE LeanFT are now Micro Focus UFT and Micro Focus LeanFT. Micro focus completed merger with HPE software. Read more..

We are using IntelliJ IDEA for all the demonstrations for this tutorial series. If you are using any other IDE and facing any issues, let us know via comments, we will try our best to help.

What is Application Model?

Application Model is like Object Repository in UFT. It contains test object’s hierarchy, description and properties. Applications model enables you to maintain your test objects at a single location for use across entire suite.

How to Create Application Model?

Application Model can be created as a dedicated Application Model project or as a part of existing Project.

Create a New Application Model

Step 1: Open New Project Wizard from Menu Option – File> New Project

Select LeanFT Option on the left and Application Model Project on the right.

Click Next

Step 2: Select “Create as maven Project” if you are creating application model as Maven Project else Ignore and click “Next”

Step 3: Provide Project name, Location details and click “Finish”

Create Application Model in an existing project

In the project explorer pane, right-click the src folder

select New > LeanFT Application Model item, and provide a name for the item.

The item (.tsrx) is added under the src folder and a corresponding .java file is generated under the appmodels folder.

Application Model File Extension

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.

Adding Test Objects Manually

Step 1: Open application model and Click on the “create new test object” button.

Step 2: New object pane will be displayed

Step 3: Provide the object name, technology, type and description for the object.

Step 4: Once you select the technology and the type of the object, you will see the list of properties populated for the object.

select the properties you want to use and provide the values for the selected properties.Enable regular expressions, by clicking on the star next to the value textbox.

Step 5: Click on the save button on top, Test object will get added in Application model

If you want to see only the used properties, click on the “Used” button else select “All” to see all properties

That’s it, you have successfully added your test object to application model. Let’s see, if you done it correctly and used appropriate properties for objects to be identified. Just like in UFT and TestComplete, LeanFT also has “highlight object” feature. Select added test object and click on highlight button.

If LeanFT is able to identify the object, you will get a successful message as below

Add Test Objects using Object Identification Centre

Refer our earlier post on Object Identification Center (OIC)

At the bottom of the OIC, click the Add object   http://leanft-help.saas.hpe.com/en/14.00/HelpCenter/Content/Graphics/Spy-AMToolbar.png   pop-up button and select Add or Locate.

Add : In simple mode , All starred objects that do not yet exist in the listed application model are added. While in Edit mode, The object that is in focus is added, as well as any checked parent objects that do not yet exist in the application model.

Locate : If a test object in the listed application model matches the description the OIC is using, the application model opens and that object is selected in the model. If you checked an object and one or more parents, the OIC first looks for the parent objects, and then tries to locate the selected test object only within the specified parent objects.

OIC Add to App Model

Using Application Model in Test

In your LeanFT test, add an import line for your application model. Instantiate the application model class and start using objects.

 

Convert UFT Object Repository to LeanFT Application Models

LeanFT comes with a small utility program which helps to convert existing UFT repositories to application models. This is named as – OR2APPMODELCONVERTER and can be found at LeanFT installation folder

<LeanFT installation folder>\bin

If LeanFT is installed with UFT, you can find it at UFT installation folder

<UFT installation folder>\bin

The usage syntax is as follows:

OR2AppModelConverter ObjectRepositoryFile ApplicationModelFile LogFile LogLevel

ObjectRepositoryFile

Provide the full path to the repository. It can be:

  • A shared object repository file (*.tsr)
  • A local object repository file (*.bdb)
  • An exported object repository file (*.xml)

Note: If the repository you provide includes test objects from UFTadd-ins that do not have a parallel in LeanFT, those objects will be ignored during the conversion.

ApplicationModelFile

The full path of the application model (*.tsrx) file you want to create.

LogFile

Optional. The full path of a log file containing details of the conversion.

Although this option is optional, it is recommended.

If the utility is unable to convert a test object or a specific identification property inside a test object description, that information is indicated in the log (if you use the LogFileoption). You can use this information to fix such issues manually in the LeanFT Application Model editor.

LogLevel

Optional.The minimal severity level to include in the report. Possible values: Info | Warning | Error.

For example, if you specify Warning, then Warnings and Errors will be written to the report, but general information data will be excluded.

6 COMMENTS

  1. Hi Saket,

    I am trying to write a script in Java language to test the file upload functionality in LeanFT 14.5. I captured activity by OIC/Application Model, however, it is not running.

    Please help me.

    Thanks,
    Manish Kumar

  2. Hi Saket,

    Please find code-snippet:
    @Test
    public void testUploadFile() throws GeneralLeanFtException {

    //Launch Chrome
    Browser browser = BrowserFactory.launch(BrowserType.CHROME);

    browser.navigate(“https://uploadfiles.io/”);

    //This is NOT getting invoked while running
    browser.describe(WebElement.class, new WebElementDescription.Builder()
    .innerText(“Drop file here or click to upload. (5GB max) “).tagName(“FORM”).build()).click();

    }
    Thanks,
    Samir

  3. Hi Saket,

    Please find code-snippet:
    @Test
    public void testUploadFile() throws GeneralLeanFtException {

    //Launch Chrome
    Browser browser = BrowserFactory.launch(BrowserType.CHROME);

    browser.navigate(“https://uploadfiles.io/”);

    //This is NOT getting invoked while running
    browser.describe(WebElement.class, new WebElementDescription.Builder()
    .innerText(“Drop file here or click to upload. (5GB max) “).tagName(“FORM”).build()).click();

    }
    Thanks,
    Manish Kumar

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.