Defining the Environment

Before implementing the Testing Agent, the environment that the Testing Agent needs to support must be clearly defined. This includes defining the test objects relevant for the environment, icons to represent these test objects in UFT One, the test object identification properties, the operations that can be performed on each test object, and so on. For information on defining a testing environment, see Planning Your UFT One Testing Agent.

UFT One requires that the environment definition be provided in XML format according to the Testing Environment Schema. It is convenient to create an XML file that contains the environment definition in the correct format and to design GetTestingEnvironment to load this file and return it to UFT One as an XML string.

The XML environment definition that was created for the QuickID is stored in the TEASampleEnvironment.xml file, located in the <UFT One Testing Extensibility installation folder>\samples\QuickID\<Visual Studio version>\dat folder. Open the file and examine its contents:

Each classInfo element defines a test object class. The following test object classes are defined for the QuickID:

  • TEASampleApplication. The UFT One test object that represents the application itself.

  • TEASampleNameEdit. The UFT One test object that represents the text box for entering the user's name.

  • TEASampleCitySelector. The UFT One test object that represents the drop-down menu for selecting the city.

Each test object class definition includes test object methods and identification properties. For example:

  • The TEASampleCitySelector test object class definition includes a Select test object method. This method receives the name of the city to select (out of a predefined list) and when the method runs, it selects the city in the application.

  • The TEASampleApplication test object class definition includes a DisplayDetails test object method. When this test object method runs, it simulates the operation of pressing the OK button on the application, displaying the sentence:

    Your name is <entered name>. You live in <selected city>.

    This test object method demonstrates the power and purpose of UFT One Testing Extensibility. The primitive operation of pressing the OK button in the application is represented in the test by a more meaningful logical operation.

  • The TEASampleCitySelector test object class definition includes a selectedcity test object identification property. The value of this property is the index of the selected city within the list of available cities. If the Testing Agent is loaded, UFT One displays this test object identification property when you point the Object Spy pointer to the TEASampleCitySelector test object.