Making the COM Object a Testing Agent

For the COM object to become a Testing Agent and enable UFT to recognize and operate on objects in your environment, the COM object must implement interfaces defined in AutInterface.idl, located in <UFT Testing Extensibility SDK installation folder>\SDK\Ifs.

The most important interface in the UFT Extensibility Agent type library is ITestable. This interface defines the methods that the Testing Agent must implement to support the basic UFT abilities. The ITestable interface is therefore considered mandatory in the development of the Testing Agent.

In the initial development stages, the QuickID Testing Agent was designed to implement only the ITestable interface. (In the later stages of developing the Testing Agent, Stage 7: Implementing Support for Recording and Stage 8: Implementing Support for the Object Spy, additional interfaces are implemented.)

For this purpose, the UFT Extensibility Agent type library was imported and the Testing Agent class was defined to inherit from the ITestable interface, as follows:

  1. Importing the UFT Extensibility Agent type library

    In the TEASample.idl file, the line: importlib("AutInterface.tlb"); was added to the TEASampleLib type library definition.

    The AutInterface.tlb file imported by the type library is located in the <UFT Testing Extensibility SDK installation folder>\SDK\Ifs folder.

  2. Inheriting from the ITestable interface

    The following steps were performed to define that the Testing Agent implements the ITestable interface:

    1. In the TEASample.idl file, the coclass TEASampleTestableImp definition was modified to indicate that it implements the ITestable interface.

    2. In the TEASampleTestableImp.h file:

      • The following line was added to the CTEASampleTestableImp class inheritance list:

        public IDispatchImpl<ITestable, &__uuidof(ITestable), &LIBID_AutInterface>
      • The following line was added to the CTEASampleTestableImp class' COM Map:

      • All of the methods in the ITestable interface were declared members of the CTEASampleTestableImp class.

    3. In the TEASampleTestableImp.cpp file, all of the ITestable methods were added with a default implementation returning E_NOTIMPL.