Stage 2: Introducing the Environment to OpenText Functional Testing
After creating the infrastructure for the Testing Agent, the next stage is to implement the GetTestingEnvironment method to introduce the environment to OpenText Functional Testing. OpenText Functional Testing calls the GetTestingEnvironment method when it loads the Testing Agent.
In this stage of the QuickID Testing Agent development, an XML definition of the environment that the QuickID application represents was created, and the GetTestingEnvironment method was implemented to return this XML definition.
Defining the Environment
Before implementing the Testing Agent, the environment that the Testing Agent needs to support must be clearly defined. For example, this includes defining the test objects relevant for the environment, icons to represent these test objects in OpenText Functional Testing, the test object identification properties, and the operations that can be performed on each test object. For information on defining a testing environment, see Planning Your Testing Agent.
OpenText Functional Testing 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 OpenText Functional Testing as an XML string.
The XML environment definition that was created for the QuickID is stored in the TEASampleEnvironment.xml file, located in the <OpenText Functional Testing Extensibilityinstallation 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 OpenText Functional Testing test object that represents the application itself.
TEASampleNameEdit. The OpenText Functional Testing test object that represents the text box for entering the user's name.
TEASampleCitySelector. The OpenText Functional Testing 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
TEASampleCitySelectortest object class definition includes aSelecttest 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
TEASampleApplicationtest object class definition includes aDisplayDetailstest 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 OpenText Functional 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
TEASampleCitySelectortest object class definition includes aselectedcitytest 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, OpenText Functional Testing displays this test object identification property when you point the Object Spy pointer to theTEASampleCitySelectortest object.
Implementing the GetTestingEnvironment() Method
When OpenText Functional Testing loads a Testing Agent, it calls the GetTestingEnvironment method to return the XML environment definition. OpenText Functional Testing uses the information returned by this method to build the collection of test objects to use for this environment.
For the QuickID Testing Agent, the method CTEASampleTestableImp::GetTestingEnvironment (in the TEASampleTestableImp.cpp file) was implemented to load the TEASampleEnvironment.xml file described above and return its content.

