Every Success Story Requires a First Step

How to write visual UI automation tests using graphics instead of complex locator strings

The article by Stefan Dirnstorfer explores how visual user interface (UI) automation testing can use graphics instead of traditional text-based locator strings. In conventional UI testing, developers rely on complex strings like CSS selectors to identify elements for interaction, which can become cumbersome, especially as tests grow in complexity. Dirnstorfer argues that using images to represent elements and their expected behavior simplifies this process, making tests more intuitive and human-readable. This approach not only removes the dependency on specific naming conventions but also allows testers to visualize discrepancies easily through side-by-side image comparisons, helping them spot deviations more effectively.

Visual UI testing, as explained in the article, involves storing reference images and using them to track changes in appearance, functionality, or layout. Tools like Cypress and Playwright support visual testing through image comparison libraries like Pixelmatch, which compare pixels between screenshots. However, these tools can be sensitive to minor rendering differences, such as shifts in layout or fonts, leading to challenges in accurately detecting significant changes. While open-source tools like Appium support image-based testing, especially for mobile applications, they also require extensive file management to keep image repositories organized, making scalability a challenge as test suites grow larger.

The article concludes by comparing free and commercial tools that support visual UI automation. Free tools often struggle with sensitivity to minor differences and require manual intervention to fine-tune comparisons, while commercial solutions like Applitools use artificial intelligence to improve accuracy in identifying meaningful deviations. Although commercial tools provide a more refined experience, they can be costly and computationally expensive. The future of visual UI testing lies in enhancing these systems with AI and simplifying image management, potentially transforming how testers interact with automated scripts by making tests more visual and accessible.

Read the whole article on “Ministry of Testing”.

Share on

Liked this article?

We have a lot more where that came from!
Join the subscribers who stay ahead of the pack.

By entering your email, you agree to our Terms of Service and Privacy Policy.