A UFT One user can select an object in the object repository and instruct UFT One to highlight this object in the application being tested. This enables the user to ensure that UFT One associates the test object with the correct object in the application. For more information, see Developing Support for Highlighting Objects.
For UFT One to highlight a test object in the application, the Testing Agent must implement the GetHWND method in the IHWNDSupplier interface, the GetRectangle method in the IRectangleSupplier interface, and the ITestable interface.
The GetHWND method receives the object ID of the object that needs to be highlighted, and returns the hWnd of the lowest-level window containing this object. UFT One uses this hWnd to make the object that needs to be highlighted visible.
The GetRectangle method receives the object ID of an object and returns a RECT structure that contains the coordinates of the top-left and bottom-right points of the virtual rectangle that surrounds the object.UFT One uses this information to draw the rectangle used to highlight the object in the application.
In the QuickID Testing Agent, highlighting objects was supported as follows:
In the TEASampleTestableImp.h file:
The following line was added to the CTEASampleTestableImp class inheritance list to indicate that it implements the IRectangleSupplier interface (and therefore also the IHWNDSupplier interface from which it inherits):
public IDispatchImpl<IRectangleSupplier, &__uuidof(IRectangleSupplier), &LIBID_AutInterface>
The following line was added to the CTEASampleTestableImp class' COM Map:
COM_INTERFACE_ENTRY(IRectangleSupplier) COM_INTERFACE_ENTRY2(IHWNDSupplier, IRectangleSupplier)
The Testing Agent's GetRectangle method was implemented in the TEASampleTestableImp.cpp file as follows:
The Testing Agent's GetRectangle method calls GetElementByRuntimeID with the object ID it received.
GetElementByRuntimeID determines the application object to which the object ID refers and returns the global object that represents that application object.
The Testing Agent's GetRectangle method calls the global object's CTEASampleObject::GetRectangle method. The method is implemented in the TEASampleObject.cpp file.
The global object's GetRectangle method delegates the request to the CTEASampleDlg::GetRectangle method with the object ID. CTEASampleDlg is the application's dialog object, implemented in file TEASampleDlg.cpp.
The CTEASampleDlg'sGetRectangle method receives the object ID and returns the rectangle that surrounds the relevant object in the application.