Book demo
Start trial
Book demo
Start trial

The LEAP

Automation insights and productivity tips from LEAPWORK.

All Posts

Automated Performance Testing: Using Stopwatches in Test Automation

Measuring elapsed time can be a key component in test automation. For instance, a business requirement may state that a search query must not take more than 5 seconds to respond with results. Although there are dedicated performance testing and monitoring tools such as dynaTrace on the market which can provide detailed insights, LEAPWORK can easily be used to do sanity checks on business transactions using the Stopwatch building block.

The following demonstrates how a single Stopwatch is started through its green execution input connector and the elapsed time is then written to the run log after some time is spent waiting:

Stopwatch demo 1

Stopwatches reset every time their green execution input connector is triggered. This will for instance log approximately 5 seconds to the log endlessly until the case is manually stopped (for instance with the keyboard shortcut F10):

Using stopwatches demo

The Stopwatch block can be used in many different scenarios. Here's an example that reads search terms from an Excel sheet and then types them into the search box on ebay.com and checks that the results are never shown more than 5 seconds later:

Using stopwatches on ebay

The Stopwatch is started as soon as the search term is entered and the elapsed time is checked as soon as the "results" are found on screen. A Set date/time block is used to specify exactly 5 seconds as the comparison value.

It's worth noting that even though LEAPWORK isn't well suited for very precise performance testing, by using the fast image recognition algorithms in eg. a Find image block, only a few hundred milliseconds might be "lost" between the different steps in the test case and so the results are at the very least a good starting point for further investigations.

The "Elapsed time" property of the Stopwatch block can be expanded to reveal individual hour, minute, second and millisecond counters. But there's another use for the total "Elapsed time" property that can be useful. When compared in a Compare block using the comparison type "Number", the value is automatically converted to the total number of seconds with milliseconds as decimals. So for instance, 00:01:05:231 (one minute, five seconds and 231 milliseconds) will be understood as the value 65.231.

This can simplify the test case by removing the need for the Set date/time block. In the example below, 3 seconds are used as the comparison value B:

Using stopwatches to find results

For another example of how to use Stopwatches in LEAPWORK, see this Learning Center video.

Everything you need for codeless test automation

Learn more about codeless test automation in our guide to reducing risk, lowering costs, and driving value with test automation.

CTA-StartTrial-8

Claus Topholt
Claus Topholt
CTO and co-founder of LEAPWORK.

Related Posts

Working from Home During a Pandemic: 5 Things We’ve Learned So Far

Working from home is no longer an option for most people around the world – it’s a necessity. While some are thriving and enjoying this new reality, others struggle to stay productive, engaged and connected. For most, it’s undoubtedly unknown territory.

3 Automation Hacks that Keep your Web Applications Stable during Unpredictable Times

As the Coronavirus continues to spread across the globe, many people are spending an increasing amount of time online for work, entertainment, information and practical day-to-day purposes.

Testing ServiceNow: What, Why and How

Frequent system updates, as well as customization, put a lot of pressure on ServiceNow customers to continuously verify thousands of business-critical processes.