Designing Test Object Configuration XML File in QTP

Designing Test Object Configuration XML File in QTP

In this file, you define any custom test object classes that you want QTP to use to represent your custom controls in tests and components. Define a test object class for each custom control that cannot be adequately represented by an existing Delphi test object class.
In a test object configuration XML, you define the test object classes (for example, their identification properties, the test object methods they support, and so on). To do this you define a ClassInfo element for each test object class. In addition, you define the name of the environment or custom toolkit for which the test object classes are intended (in the TypeInformation\PackageName attribute), and the QTP add-in which these test object classes extend (in theTypeInformation\AddinName attribute).

If the relevant add-in is not loaded when QTP opens, QTP does not load the information in this XML. Similarly, if the name of the environment or custom toolkit is displayed in the Add-in Manager dialog box and its check box is not selected, the information in this XML is not loaded.

A test object class definition can include the following:

  • The name of the new test object class and its attributes, including the base class—the test object class that the new test object class extends. The test object class name must be unique among all of the environments whose support a QTP user might load simultaneously.
  • The generic type for the new test object class, if you want the new test object class to belong to a different generic type than the one to which its base class belongs. (For example, if your new test object class extends DelphiObject (whose generic type is object), but you would like QTP to group this test object class with the edit test object classes.)
  • The path of the icon file to use for this test object class (Optional. If not defined, a default icon is used.) The file can be a .dll or .ico file.
  • A context-sensitive Help topic to open when F1 is pressed for the test object in the Keyword View or Expert View. The definition includes the Help file path and the relevant Help ID within the file.
  • A list of methods for the test object class
  • The test object operation that is selected by default in the Keyword View and Step Generator when a step is generated for an object of this class.
  • A list of identification properties for the test object class

Note: You can also create a definition for an existing test object class in the test object configuration XML. This definition is added to the existing definition of this test object class, affecting all test objects of this class. It is therefore not recommended to modify existing test object classes in this way.

If you add a test object method, it appears in the list of test object methods in QTP, but if you use the test object method in a test, and it is not implemented for the specific object, a run-time error occurs.

If you add test object methods to existing test object classes, you might add a prefix to the method name that indicates the toolkit support for which you added the method (for example, CustomButtonClickCustomEditSet). This enables test designers to easily identify the custom methods and use them in test steps only if they know that the custom method is supported for the specific object.

Rahnuma Tasnim

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top