Squish Qt tips & tricks: Working with objects without unique properties
At Spyrosoft, we know that when it comes to software testing, efficiency and precision are crucial. This is where Squish, a versatile framework for automated GUI testing, comes in. In this article, we share tips and tricks for some of the most common problems in Squish when working on Qt test automation projects. We also explore how to handle objects that don’t have the usual properties that software testers typically rely on.
What are Qt applications?
Qt apps are developed using the Qt framework. Qt is a cross-platform, C++-based framework that provides a wide range of tools and libraries for creating GUIs (graphical user interfaces) and other software components for desktop, mobile, and web applications.
The biggest advantage of Qt apps is that they can run on multiple operating systems, including Windows, macOS, Linux, Android, and iOS. With Qt apps, developers can write code once and deploy it across various platforms. There’s no need to deal with significant code modifications.
Because of this versatility, Qt is commonly used in various industries. It’s especially popular for building cross-platform applications with rich graphical interfaces.
What is Squish?
Squish is an automated testing tool. It’s mainly used to test graphical user interfaces (GUIs) in applications developed with Qt. Squish is one of our main testing tools, mainly because of the significant benefits this tool offers:
- Cross-platform capabilities: Squish supports a wide range of platforms, including Windows, macOS, Linux/Unix, iOS, Android, and various embedded systems. As a result, we can use the same testing processes across different platforms.
- Support for diverse GUI Technologies: We use Squish to test applications built using various GUI technologies, such as Qt, Java, Windows Forms, Web (HTML5/JavaScript), and more.
- Automated testing: Squish can be integrated into CI/CD processes, which makes automated testing possible and effective. This way, we can deal with potential issues early in the development process.
- Squish GUI Tester: The Squish GUI Tester is a versatile tool for executing automated tests across various scenarios, including distributed batch testing and hybrid applications. It supports multiple scripting languages and offers an intuitive environment for recording and playback, enhancing the testing process.
Want to learn more about our Qt services offer?
Learn moreSquish for Qt – handling QA automation obstacles
Now that we’ve covered the basics, let’s look at a common test automation challenge. It’s when the object we want to use in a script doesn’t have a unique ID.
Producing stable and powerful test scripts is crucial in overcoming these QA automation obstacles. These scripts simplify test creation, maintenance, and troubleshooting, especially when leveraging object maps and object identification tools.
While working with Squish, we can look for other unique object properties and use them to create accurate and reliable automation. However, occasionally we miss both of these crucial ingredients for successful automation. For example, this can occur due to a lack of cooperation from developers or just because some of the specific QML properties that cause the side effect of having multiple elements with the same properties.

In this example, the QML developer attempts to create a list of buttons with some labels. Of course, you could modify this to create a unique ID. But test automation often starts late in the project, when there’s already a lot of technical debt.
The output of the above code looks like this:

Now, if we would like to start automating tests on such a UI, we should follow the received requirements, which tell us to interact with the button next to menu item 1.
After opening Squish and using the selector on the switch next to menu item 1, we get this as a locator dictionary:

As we can see, there is a generic ID, which is the same for all switches on that menu. We can’t use this because the occurrence property causes instability in tests once something is added to that menu.
Working around graphical user interface tests in Squish for Qt
In the past, the Froglogic blog has posted code for traversing the QML tree to find children of your selected object and expected objects. The post itself was really helpful, but with little enhancement, it can be an excellent tool for working around such issues as in the example above.
Here is the code for finding these children with the enhancement, for which we give an explanation below:

The challenge of test automation in UIs with repeated elements
With the above functions, we can select any object that can be a sibling of the thing we are looking for, or even a great grandchild of a sibling of such an object. So, let us look at this, starting with the basics.
Visualising the QML tree structure
Here is the QML tree displayed in Squish with your desired object selected:

The binary tree of this looks like this:

Running the code below can get us an exact reference to our desired switch:

Step-by-step: How the object traversal works
Now, let’s have a closer look at the whole process:
- We traverse up the QML tree to Row 0 with parent_container.parent and parent_count=1
- Next, we are creating our list to store the children we find.
- Finally, we loop over the children in the container, looking for the desired type or properties. We store all matching objects in a list, and then we use recursion to run deeper, looking for grandchildren, etc.
- We output results as a list (we used [0] because we were expecting a single child matching our desired requirements).

Overcoming limitations in UI automation due to missing IDs
Having IDs or unique properties is always the best way of working. However, there are times when, whether due to technical debt or tight deadlines, we can’t get developers to add these missing things that are vital for our test automation scripts.
While the above solution combining Squish with QT is not perfect, it still delivers tools to work around some of the issues and can be a great test automation enhancement if used carefully.
Summary
To sum up, both Qt and Squish are powerful tools for efficient software development and its testing. Qt is a versatile framework for cross-platform development, while Squish automates and enhances testing procedures.
Putting these tools together streamlines development and ensures high-quality software by automating testing, naturally contributing to significant time and cost savings.
Looking for an experienced team that can help you develop a Qt application or test it using Squish? We’re at your service. To learn more about Squish for Qt, check our Qt services or contact us directly via the form below.
FAQ
If your GUI objects lack unique IDs or stable properties, you can still automate them by traversing the QML tree using enhanced recursive scripts. This method lets you locate elements by hierarchy, type, or sibling relationships – avoiding reliance on unstable occurrence properties and improving the reliability of your test automation.
While developer collaboration helps by providing unique object properties or IDs, Squish still allows testers to create automation scripts without this input. By using intelligent traversal techniques, testers can interact with GUI elements based on their context or structure – even in technically constrained environments.
Unlike general-purpose automation tools, Squish is built specifically for GUI testing and has deep integration with Qt. It supports QML, Qt Widgets, and hybrid interfaces, and provides advanced scripting features in Python, JavaScript, and other languages. Froglogic (now part of The Qt Company) ensures native support and frequent updates tailored for Qt.
Absolutely. Squish can be integrated into popular CI/CD tools such as Jenkins, GitLab CI, or Azure DevOps. This enables continuous GUI testing and early bug detection, accelerating feedback loops in agile development environments and improving overall software quality.
About the author
CONTACT US