Lucio Gayosso, Sr. Consultant/Nearshore Team Lead

With complex systems and aging systems, there is an ever-increasing need for automated testing which can be challenging on some CA Plex Systems where the GUI controls have not been modernized. A problem with some automated testing tools is that it is difficult to see some old WinC controls as unique objects in a panel by the Testing Suites’ controls inspection process. But don’t worry. There is a setting in CA Plex that allows for unique control identification.

Process

Setup required for Test CA Plex Application:

[Options]
Allocate Fixed Control IDs=1

With CA Plex r7.2, the Control IDs for each GUI panel elements can now be stored in the panel design for each panel so that external testing tools can use such unique identifiers (control IDs) to access each control. This feature makes creating test scripts against WinC applications much more robust against changes to label text or panel element reordering.

This feature now resolves a known limitation of CA Plex-generated C++ Client applications in which resources generated onto the UI have internally allocated (or ‘mangled’) names generated within the source. These internal names could vary between generations of the same UI panel, thus making it hard for external tools that reference these Control IDs to reliably reference each control consistently.

An example of this feature can be found in the online help, where source that was generated for a Customer Name edit box field within a WinC panel function includes a unique identifier (highlighted below):

Resource (.RC) File:

/* Control: */
0xABCD1234L, /* Check */
157, /* Id. */
OB_CTRL_TYPE_EDIT, /* Control Type */
96, 216, /* Position */
92, 20, /* Size */
0L | HES_AUTOHSCROLL | HES_DISPLAYLEFT | HES_INDENT | WS_TABSTOP, /* Window style */
0L | OBCS_TOPJUST | OBCS_LEFTJUST | OBCS_3DCLASS, /* Control Style */
141, /* Window Text */
0, /* Fly-over hint */
-1, /* IME Mode */
0, /* DBCS flag */
0, /* EBCDIC flag */
0,
142,
108,
2, /* Enumerated border value except for ActiveX and Grid controls. */
0, /* iExtraInfo2 */
0, /* iExtraInfo3 */
0, /* iExtraInfo4 */

Main Source (.CPP) File:

pHEdit HEdit_157; /* CustomerName */

In this example, the value 157 has been assigned to the control at generation time, and the value 157 is used both in the resource file and in the C++ source file to identify the control. This Control ID property is initially empty for all control elements. Any value that you enter for this property can be used to uniquely identify a control when the panel is generated with one of the GUI generators (WinC, Java, and C#). This property is available for all panel elements that can be generated into a resource file, including the following:

  • Panels
  • Events
  • Regions (Single instance and Grid)
  • Fields
  • Labels
  • Edit, Combo, and List boxes
  • Grids
  • Buttons

To enable this feature, add the following entry in the .BLD file for a local model.

[Options]
Allocate Fixed Control IDs=0|1

With this setting, the generation of a panel will define the Control IDs as in this example:

The Control IDs are stored locally for each panel that is generated therefore some considerations need to be made to reconcile work, as described in the next section. Control IDs are not inherited from other panels; they are only stored locally within each panel design.

Process to Work With the Control ID Property

  1. Extract a new local model for your application
  2. Set the Allocate Fixed Control IDs to 1 in the BLD file for the local model.
  3. Generate and Build all the UI functions that scope a panel in your application.
  4. Ensure you save the local model once you have generated it. Control IDs are allocated for all design elements on all implemented panels in the application.
  5. Test the user interface for your application and ensure that it functions as expected
  6. Update the group model for your application with the newly updated Panel large properties
  7. Every team member in the Project must extract
  8. You can now reference the controls generated for your application in TestComplete

Important considerations:

  • Whenever a user interface element(s) is/are added to a panel that is used in the application that panel needs to be regenerated so that Control IDs are added for the new element(s). This includes regenerating all panels that inherit from abstract pattern panel changes that can result in the UI changes.
  • Ensure that you update the group model with these changes and all developers extract before working again with that panel
  • Ensure the Allocate Fixed Control IDs is set to 1 for all local models that you work with because the Control ID property is ignored for panels generated for a local model unless this option is set.