1

I'm trying to automate some GUI testing with Squish and keep getting problems with MFC resource IDs in Squish.

I create a static label like this:

CStatic m_Status;
m_Status.Create("", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE | SS_LEFT, 
                mCfg->rectStatus(), this, 42);
m_Status.SetWindowText("42 is the answer");

When I spy this label with Squish, all I get is:

{"container": o_Pane, "text": "42 is the answer", "type": "Label"}

however, there's no ID. As the text is changing, matching element based on the text alone is not optimal.

In the same program other labels are created via the resource manager wizard. For those labels Squish is able to get both the resource ID and set the correct "nativeObject" property.

Is there some way to make CStatic objects created in the source code also properly visible to the Squish, with the nativeObject property if possible?

jpou
  • 1,935
  • 2
  • 21
  • 30

1 Answers1

1

Spying can be used for inspecting the object properties. Once you know which properties Squish sees, you can use the properties and their values in Squish object real names for identifying the desired object.

However, since the MFC support of Squish is not compiled in, it typically has no way to access such IDs, since it gets all its information about MFC controls via Window Messaging.

It might be that these IDs are exposed via UI Automation. Check with Inspect if that is the case. And if so, try identifying the object via Squish' UI Automation support. For this change the priority in SQUISH_DIR\lib\extensions\win\uiautomation.ext to be higher than the priority in SQUISH_DIR\lib\extensions\win\mfc.ext, use a new test suite (for good measure and testing), launch the AUT from Squish, pick the object and see if you see different object properties, and if the nativeObject properties is non-null (being empty/null implies that the MFC supports is providing access to the object).

frog.ca
  • 684
  • 4
  • 8