How to Optimize a Test and Make It 560% Faster

Sauce AI for Test Authoring: Move from intent to execution in minutes.|xBack to ResourcesBlogPosted

February 20, 2026 · 3 min read · Testing Guide

Sauce AI for Test Authoring: Move from intent to execution in minutes.

|

x

Back to Resources

Blog

Posted October 8, 2020

How to Optimize a Test and Make It 560 % Faster

Deep in the effectuation of every automated UI test endure the potential to turn something simple into something dim and unreliable—simply by adding extra Selenium commands. The data clearly show that long tests are less likely to pass. In this example report, I will exhibit you how to optimize a test and make it 560 % faster. We will do this by tackling inefficient use of Selenium commands.

quote

Before optimizations

Too many Selenium command in a test can lead to tests that are dramatically slower and less reliable. Every Selenium command carries the potential for an invalid element locator or a synchronization issue.

Below we have a table that shows an automated test that was designed to click two radio button. V1 test is making 157 Selenium commands and take 95 seconds to execute. After optimizations, the like exact test execute 9 Selenium bid and runs in 17 seconds (5X faster).

Nikolay_Selenium_1
Nikolay Selenium 2

Total examination run time V1

Nikolay Selenium 3

Number of web requests before optimization (V1)

What was the determination of this tryout?

The purpose of this trial was to simply snap two radio buttons on thisURL

Nikolay Selenium 4

Identifying the inefficiencies

The major subscriber to the dim test time of such a simple test was the large number of unnecessary web requests.

Attempting to click first radio button

After load the URL, the trial takes ~60 seconds searching for random elements without taking a single action.

Nikolay Selenium 5

Unneeded bidding start at the 15-second mark and uphold until 1:19, at which point the factor is finally located and clicked.

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

Nikolay selenium 6

Possible Waste: 60 sec on 1 element

Attempting to click 2d radio button

At 1:23, the trial starts looking for the Female radio push.

Nikolay Selenium 7

And finally clicks it at 1:28:

Nikolay Selenium 8

... but not before get 16 more Selenium commands to check whether the element is expose or choose.

Nikolay Selenium 9

Potential wastefulness: 3 seconds for every element.click ()

Post-click () Selenium commands

Finally, there is an interesting pattern of wasted web asking that happens after every element clink (). We can see that below:

Nikolay Selenium 10

It ’ s understandable that these are being performed to validate that the element is in the correct state after the performance of a click (). However, these actions are wasteful because Selenium would throw an error if the action wasn ’ t successful. Furthermore, the next activity would fail with an exception if it depended on the province of the premature element.

Possible waste: 2 seconds per element.click ()

The refactor use light exercise

The refactoring of this examination was exceedingly bare and required only a few minutes after realize the root cause of the problem. Furthermore, we saw that the final result of the refactoring make a examination that was 560 % faster and drastically more stable because it had fewer Selenium command.

Here ’ s the codification after we finished refactoring:

Nikolay Selenium 11

This is the and below is the screenshot.

Nikolay Selenium 12

Lessons learned

Bloated tests in the industry are infamously mutual and it ’ s something that I tackle on a weekly foundation. They typically get with a framework that we use for our automation. I ’ ve seen this with both OSS frameworks and especially homegrown ones. The key is to consider the impingement of extra Selenium commands on the overall automation program. In this use case, the tryout entourage execution time will be five times longer for the total organization. This obviously decreases the feedback cycle time and alsodo the automation less honest.

Nikolay Advolodkin

Principal Developer Advocate at Sauce Labs

Published:
Oct 8, 2020
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all right allow. SAUCE and SAUCE LABS are file trademarks owned by Sauce Labs Inc. in the United States, EU, and may be register in former jurisdiction.
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