Defining New Test Object in QTP

You can add test objects to the Object Repository that do not exist in your application. This enables you to make an Object Repository and build test scripts for your application before the application is eligible for testing.

test object1.bmp

When you define a new test object in the Object Repository, a particular object is added to the local Object Repository and can only be used by the current action. We can add the test object to a shared Repository so that it can be used in multiple actions, by adding the Test Object using the Object Repository Manager.

test object2.JPG

How to define a new Test Object:

  1. Select the correct object hierarchy in which you want to add the new Test Object.
  2. Select "Object-Define New Test Object" or click on the "Define New Test Object" button. The Define New Test dialog box opens.
  3. Select the appropriate environment from the Environment box. Test object classes associated with the selected environment are displayed in the class box.
  4. Select the class of the test object that you want to define from the Class box.
  5. Enter a name for the new test object in the Name box. After you enter a name, the Test Object details area is enabled.
  6. Define the properties and values for your test object in the Test Object details area. The Test Object details area automatically contains the mandatory properties defined for the object class in the object Identification dialog box.c You can add or remove properties as required, and define values for the properties. Click Add. The new test object is added to the local object Repository in the selected location.

    test object4.png
  7. Repeat step 3 to step 7 to define additional test objects, or click close to close the Define New Test Object dialog box.
                     test object3.png