Suppressing and UnSuppressing Native Recording

UFT One 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 One recording.

For example, the test below was recorded before implementing suppression in the QuickID Testing Agent. The UFT One 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 One recognizing the application as a standard Windows application.

Two types of recording suppression are available: static and dynamic. For more information, see Suppressing UFT One 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:

  1. The BeginRecording method calls the private method SuppressWindow.

  2. 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.

  3. 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.

  4. 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.