About the test object hierarchy in the application model

LeanFT identifies test objects within context of their parent objects. The top-level parent represents the host application, such as a browser or window.

When creating test objects manually, you define the top-level parent object and then define the other objects as child objects.

When working with the Application Model, you can define an application model without the parent test object inside.

More specifically:

  • For Web, Mobile, and SAP GUI for Windows applications, the parent object is never defined within the Application model.
  • For other Windows-based applications, you can decide whether the parent window is defined inside the model or external to it, in your test.

When you create an instance of your application model class in a testing project, you can call it with or, for Windows-based applications, without a constructor.

  • If you call it without a constructor: appmodel MyApp = new appmodel(); then the top-level parent defined in your application model is used. (Relevant only for Windows-based applications.)

  • Alternatively, you can define your parent object (such as a Window, GuiSession, or Browser) within the scope of your test and then pass that parent object as the context for the application model class.

    For example:

    IBrowser MyBrowser;
    MyBrowser = BrowserFactory.Launch(BrowserType.Chrome);
    appmodel MyApp = new appmodel(MyBrowser);

Using this model, you can test objects from the same application model using different browsers or hosting applications.

For example, you could test the objects in an embedded browser control using the Web objects defined in your application model, even if the host application is a Window.

See also: