Test-object hierarchy in the object application model

Test objects are identified within the 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 top-level parent test object inside.

More specifically:

  • For Web, Mobile, and SAP GUI for Windows applications, the top-level parent object is never defined within the application model.

  • For other Windows-based applications, you can decide whether the top-level parent window is defined inside the application model or external to it, in your test.

  • If you are working with a grid configuration, you must always define the top-level parent object in your test, and not inside the application model.

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 top-level 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.

Note: Each application model can descend from only one external top-level parent object. If you want to test the descendents of more than one external top-level parent object, you must have a separate application model for each top-level parent's descendents.

See also: