1 Simple Trick To Massively Improve Automation Efficiency

Sauce AI for Test Authoring: Move from intent to execution in bit.|xBack to ResourcesBlogPosted October 22, 2020

1 Simple Trick To Massively Improve Automation Efficiency

In this article, Nikolay Advolodkin presents a case study to show how interaction with only two web elements led to a 34 % degradation in test execution time. He will show you how to take this inefficiency by simply keeping the element location timeout to a uttermost of 20 seconds on mobile devices.

quote

Automated UI testing is a daily struggle for efficiency and reliability. Asingle misconfigured line of codecan cost teams in hr of lose feedback time and test error triaging—potentially costing companies hundreds of yard of dollars.

In this case report we will see how interactions with only two web constituent led to a 34 % degradation in the test execution time. Afterwards, we will con how to take this inefficiency by simply keeping our constituent positioning timeout to a maximum of 20 seconds on mobile devices.

What Our Final Test Can Look Like

Nikolay_img1
Nikolay img2

Screenshot of the tryout metadata before optimizations

Trying to Find Element 1

In the screenshot below, we start looking for element 5015 at ~0:55.

Nikolay img3

And the test continues to look for this component until 02:12, at which point the test decides to displace on.

Nikolay img4

What Were These Commands Doing?

Looking at the locater, screenshots, and video, it ’ s obvious that the examination was waiting for a spinster to disappear. After a closer analysis, it ’ s clear that the spinner is gone and the mobile app is in a ready state by 1:00.

Afterwards, the test wastes 72 seconds waiting for a spinner to not re-emerge before proceeding with the next actions.

Inefficiency Cost

19%= 72 / 377, judge to find a individual element.

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

What ’ s The Solution?

First, simply lessen the amount of clip that we wait for elements to disappear. 20 moment per element on a mobile device is sufficient. If an app isn ’ t supply in 20 moment on a mobile twist, we have a bigger job. 🙊

Second, the logic to wait for a spinner to disappear is actually incorrect. The examination should look while the spinster is visible. When the spinster vanish, at that point the test can proceed. As a solution, the test will only wait as long as necessary for the spinster to go away.

Trying to Find Element 2

There is another inefficient figure in this trial that ’ s treat with element 5033. At 2:23 the trial locate this element.

Nikolay img5

After the test finds element 5033, it begins a cycle of calling the same three Selenium commands from 2:24.

Nikolay img6

This cycle restate until 3:40 (76 seconds total), at which point a screenshot is captured and then the test is stopped.

Nikolay img7

What Were These Commands Doing?

These dictation were looking for some element that ne'er appear.

The Problem

The extremely mutual subject hither is that there is no intellect to waste 76 mo looking for a individual element. This is simply too long. As mentioned antecedently, 20 seconds on a mobile device is sufficient for 99 % of cases for a page to furnish.

Inefficiency Cost

15%= 56/377, squander on looking for a individual element.

What ’ s The Solution?

The solution is the same as above: decrease the timeout to 20 seconds maximal. What benefit execute the test get if it drop 56 more seconds seem for an element?

Total Damage From Inefficiency

128 seconds out of 377 (34 %) are spent on trying to situate only two elements! What ’ s even scarier is that this pattern is almost certainly applied throughout the entire organization as a issue of the framework, probable costing teams dozens of hours every single day as a consequence of overexaggerated timeout values.

The solution to this problem is elegantly simple. Set a 20 second timeout for all your component locators on a mobile application. For the tumid bulk of cases this will be more than flock. If we observe that this is not sufficient and we keep seeing false positives, then we can increase the timeout.

If you & # x27; re interested in more like this, check out my other post onhow to optimise a test and make it 560 % faster.

Nikolay Advolodkin

Principal Developer Advocate at Sauce Labs

Published:
Oct 22, 2020
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks have by Sauce Labs Inc. in the United States, EU, and may be register in other jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free