Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Accessing a CMFCToolBarButton for UI Automation

$
0
0

Hi wise guys and ladies, I've been playing, reading, and researching for a week and my boss wants so see progress, so I decided to ask in this forum. My task is to make an application fit for coded UI tests which has been under continued development for 10 years or so, and contains tons of legacy C++ code so that rewriting is not an option. The first simple (or so I thought) test is: load data into the application, read out the GUI which displays some basic information about the loaded data, and verify that what we read is what we expect.

It was easy to load the data, but I cannot read the data from the GUI. The information which I need is displayed in a button in a button bar. The button class is derived from CMFCToolBarButton. In the coded UI test project, I can pick "Generated Code for Coded UI Test" from the "Test" menu and then click "Coded UI Test Builder". Then I drag the target icon to the toolbar button in question. The button is then displayed with a blue rectangle around it, and I see some of its data in a pop-up window of the Test Builder. Unfortunately, the text which the button displays is in the "Name" field, and the "DisplayText" field contains the name of the toolbar.

I then overwrote the SetACCData methods of the button class, setting the m_strAccName, m_strAccValue, and m_strDescription members of the CAccessibilityData parameter to what should be useful strings. Now the Test Builder displays a useful button name but the DisplayText is still empty. From long debugging sessions I found out that no call is ever issued that reads the m_strAccValue field.

Any ideas on reading the value of an MFC toolbar button? Or am I missing something fundamental? Thanks a lot...


Update: I found a solution which I am posting as a reply to my question.

Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>