Squish is a great automation tool to write test cases for Qt applications. By default it offers to find objects by symbolic name, which basically is the name of the object generated depending on it’s properties.
The problem is that with more complicated Qt applications there might be more complicated objects – dynamic objects. In simple terms – you record a set of actions and squish generates a code for you, where each object is named using symbolic names. When you try to run just recorded test case it fails, because squish couldn’t find the object with the same properties. The actual object in software has changed it’s properties, but object under symbolic name that’s used in a test case has the old properties.
Another reason why you would want to use the following code is that a lot of times in development process object’s properties are changed. Once the new build comes out test automation developer has to update test scripts. It may not be that complicated if there’s only couple of them, but it becomes very annoying if you have more than 50 to edit.
Froglogic offers a couple of solutions, but in my case they didn’t work. So I had to come up with my solution. Using below code it’s possible to return a list of all visible object names.