Blog

How to use computer vision to improve your test automation

Learn how computer vision helps automate Android and iOS mobile application testing.
14 November 2018
Mobile app testing
Test automation
The article by a1qa
a1qa

Computer vision is used in a variety of modern devices and security systems. However, its application in test automation isn’t widespread. Most often verifications are limited to comparing two images or searching for a particular element in an overall picture. Is it possible to go beyond this? Is there a way to make automated tests ‘see’ all objects on the screen of your tablet or smartphone, for instance?

Read our article to learn how to streamline mobile test automation through computer vision, what tools to choose, and why its application sometimes can be restricted.

In most cases, to automate testing of iOS and Android mobile apps Appium is used, which is a solid tool. However, the scope of its possibilities is at times limited.

For instance, automatic search of certain elements within the same image can become a challenge for Appium.

The issue is that it can’t track location of individual elements of an image on the screen unless developers have previously added the corresponding unique addresses for each of them. Appium will overlook them.

What is the way out? Make use of computer vision.

Computer vision potential

Computer vision is a scientific discipline that allows machines to ‘visually’ analyze their environment. Images/videos usually form the core of this process.

Nowadays, the technology allows recognizing people by their faces and postures, helps unmanned vehicles to distinguish road signs and identify pedestrians accurately. It is also used to process images in medicine and support manufacturing.

This technology serves to solve the following tasks:

  • Object identification

Computer vision assists to detect whether the video contains a particular object. Images search by their content, the assessment of the object’s location, and the defining of characters in the text also belong to the list of this function.

  • Estimating speed of moving objects

This point presupposes processing a sequence of images to determine the speed of each point of the image.

  • Image recovery

Its core goal is to remove noise (fuzzy image of an object in motion).

  • Scene restoration

If there are more than two scene models, it’s possible to recreate its three-dimensional model.

Mobile testing automation using computer vision

Furthermore, the technology under discussion serves to automate the mobile software testing process.

In automation, it is used specifically for searching for individual elements in the overall image. It is necessary to pre-cut these elements and store them. This process isn’t appropriate for mobile testing automation on devices with different screen resolutions.

Therefore, the automation of this process will help to eliminate the need to manually cut elements out, thus optimizing the workflow significantly.

How to find the necessary elements in the whole image?

Computer vision tools serve this purpose. Combining them with Appium, test automation engineers solve the existing issue.

Let’s discuss each tool in detail.

Overview of computer vision tools

OpenCV

This С/С++ based tool is an open source library that contains computer vision and images processing algorithms. It can also be applied for Java, Python, Ruby, and some other languages.

OpenCV performs image binarization by converting a full-color display to a monochrome with only two types of pixels (dark and light).

Binarization is performed by either an adaptive or a threshold method. The first one is applied only to heterogeneously lighted areas of the image. The second one detects a certain threshold, which allows dividing the image into black and white.

Built-in algorithms separate the background from the object itself, as well as search for individual elements by contours. Open source code allows combining these methods for a specific solution.

SikuliX is an alternative tool when searching for an individual element within the overall image. It represents an open cross-platform script development environment focused on programming GUIs using screenshots.

For scripts creation one may use such languages as Ruby and its implementation jRubi, Jython, constructions from Python. The program is applied for Windows, Mac OS X, Linux. SikuliX is based on OpenCV algorithms.

Tesseract OCR

This is one of the most popular and high-quality programs for text recognition from images. It is written in C/C++ and is suitable for Mac OS, Windows, and Linux OS.

This tool supports new programming languages and fonts, while neural network forms the basis of an updated product version 4.0.

Leptonica (image processing library), the latest version of Tesseract OCR, and data for learning the desired language (for example, Spanish) are necessary to start working with this solution.

When combining these tools with Appium, the automated testing of a mobile application looks like this.

A screenshot of an image is created automatically, then it is divided into separate elements. Each of them is added to a configuration file. Engineers already have the coordinates of each element.

After that Appium accesses the configuration file, obtains the necessary information, and interacts with these elements using their coordinates.

Why is computer vision not a versatile solution?

Despite its vigorous development, QA and Dev teams can’t implement it on a daily basis.

It happens due to the following factors:

  • Dependency on the image quality

Sometimes the quality is quite low. That’s the reason why computer vision tools fail to provide an accurate result.

  • Inability to automate all test cases

It happens due to the existing limitations in the process of recognizing animated elements.

To sum up

Appium is a proven and robust mobile test automation tool. However, sometimes test automation engineers opt for combining it with computer vision instruments in order to elaborate a sustainable solution.

The one that will provide you with exact and quick results and can be extended to multiple applications with minimal effort.

Contact us to get more information on test automation service.

More Posts

gaming-qa
24 August 2023,
by a1qa
4 min read
Ready, steady, test: How QA drives seamless gaming experiences
Why is QA pivotal for delivering unmatched player experiences? How to level up video game quality? Find the answers in the article.
Cybersecurity testing
Functional testing
Localization testing
Performance testing
Quality assurance
Test automation
Usability testing
debated technologies
30 May 2023,
by a1qa
3 min read
a1qa tech voice: Managing director at a1qa, North America, discusses pros and cons of much-debated technologies
Nadya Knysh, Managing director at a1qa, North America, puts a spotlight on 6 current technologies, discussing their positives and negatives.
General
Interviews
Test automation
why-do-bugs-get-missed
17 April 2023,
by a1qa
4 min read
Why do bugs get missed? Learn the problems and tips to avoid them
Still, finding overlooked bugs after the app goes live? Let’s find out why this happens and how to fix it.
Quality assurance
Test automation
Mobile app testing
15 February 2023,
by a1qa
4 min read
Mobile app testing guide: win the race with five-star software
Which aspects of mobile apps to test first to produce a really high-quality product? Find the answer to this and other questions related to mobile app testing in the article.
Cybersecurity testing
Functional testing
Mobile app testing
Performance testing
Test automation
Usability testing
a1qa-articles
31 January 2023,
by a1qa
5 min read
Best of 2022 by executives: 8 most visited a1qa blog posts
Let’s look back and revisit the most visited a1qa articles of 2022!
Quality assurance
Test automation
qa-trends
12 January 2023,
by a1qa
4 min read
The future of software testing: top 4 impactful trends that will dominate in 2023
Consider the major industry trends for the upcoming year to know how to improve current QA strategies and stay ahead of the curve.
QA trends
Quality assurance
Test automation
test-automation
7 December 2022,
by Dileep Marway
3 min read
Release at pace with test automation: What, why, and how to measure success?
An automation-first approach is key to enhancing testing capabilities and increasing overall operational efficiency. However, I would suggest justifying its implementation, so that it can deliver the promised value.
Quality assurance
Test automation
interview-with-dileep
28 November 2022,
by a1qa
9 min read
Interview with Dileep Marway on a series of articles “Agility and speed: Supercharging your business strategies with QA”
We cooperated with the VP of Engineering and Quality at SHL to present you with a series of his blog posts on: culture of happiness, test automation, and Agile-driven QA. Happy reading!
Agile
Quality assurance
Software lifecycle QA
Test automation
qa-trends-in-telecom
30 September 2022,
by a1qa
5 min read
4 telecom trends for 2023 and how to painlessly implement them with QA
It’s time to explore the telecom trends for the upcoming year. Let’s look at them together and also see the value that QA brings for their smooth deployment.
Cybersecurity testing
Migration testing
QA trends
Quality assurance
Test automation

Get in touch

Please fill in the required field.
Email address seems invalid.
Please fill in the required field.
We use cookies on our website to improve its functionality and to enhance your user experience. We also use cookies for analytics. If you continue to browse this website, we will assume you agree that we can place cookies on your device. For more details, please read our Privacy and Cookies Policy.