Open topic with navigation
UFT natively records a step for every standard Windows environment operation performed on the application. The Testing Agent also records steps specific to the application. To avoid recording two test steps for the same operation, the Testing Agent must suppress the native UFT recording.
For example, the test below was recorded before implementing suppression in the QuickID Testing Agent. The UFT user started a recording session and then entered
123 in the QuickID application name text box and selected Tokyo from the city list:
Dialog("Who are you?").WinEdit("Enter your name").Set "123" TEASampleApplication("TheApplication").TEASampleNameEdit("TheNameEdit").Set "123" Dialog("Who are you?").WinComboBox("Select your city").Select "Tokyo" TEASampleApplication("TheApplication").TEASampleCitySelector("TheCitySelector").Select Tokyo
Two steps were recorded for each operation, one based on the Testing Agent's instructions, and one based on UFT recognizing the application as a standard Windows application.
Two types of recording suppression are available: static and dynamic. For more information, see Suppressing UFT Native Recording.
The QuickID Testing Agent uses dynamic suppression. To do this, the Testing Agent calls the Suppress/UnSuppress methods provided in the IRecordSuppressor interface, defined in the UFT Extensibility Agent type library. The Suppress method receives the ID of the environment on which to ignore standard Windows events and a list of processIDs and/or hWnds on which to ignore standard events. The list of process IDs must be provided in XML format, according to the Suppression Schema.
The UnSuppress method operates similarly, but it cancels the suppression of events that occur on the specified processes and/or hWnds.
In the QuickID Testing Agent, suppression is handled in the TEASampleTestableImp.cpp file, as follows:
The BeginRecording method calls the private method SuppressWindow.
SuppressWindow calls GetWindowSuppression which creates the XML list of process IDs and returns it as a string. When suppression is activated on an hWnd, none of the standard Windows events on that window or on any of its children are recorded. Therefore, for this sample it was sufficient to query the application main window for its hWnd, and create the XML list with this hWnd alone.
SuppressWindow calls the Suppress method from the IRecordSuppressor interface with the XML list. Access to the IRecordSuppressor interface is through the object reference the agent received in BeginRecording.
Similarly, the EndRecording method calls the UnSuppressWindow private method, which in turn calls the UnSuppress method of the IRecordSuppressor interface with the appropriate XML list, as explained above.