The amount of time it takes for a test to run is dependent on a range of factors, from the latency and capacity of the test environment to the strategy and intention of individual steps. When tests and flows take a long time to run, it slows down validation and release cycles. If you’ve identified a test or flow that runs slower than you’d like, either occasionally or consistently, use the following suggestions to reduce test run time.
The ideas in this article are organized according to a top-down perspective. To reap the greatest benefit, we recommend implementing more holistic measures before tackling individual steps.
Review app performance
Start by reviewing the performance of your test over time. An increase in app load time could indicate a performance regression. If app load times consistently spike at a certain time, determine whether the test environment has the capacity to run mabl tests.
Understand the strategy of the test or flow
In some cases, you might want to re-examine the overall testing strategy. Some examples of optimizing measures include the following:
- Using an API test in a plan to speed up the login flow
- Eliminating test steps that don’t verify the end goal: Is every click and assertion necessary? Are there quicker ways to navigate to the page you want to test?
- Creating more customized flows: If many tests are using the same long-running flow, optimizing that flow can have a big impact. Options include creating several smaller flows that are more targeted, or identifying and optimizing slow steps in the flow.
- Identifying the slowest test in a parallel plan run: If a plan runs all tests in parallel and one test takes much longer than the others, optimizing the runtime of that slowest test can speed up the overall runtime of the plan.
Examine individual steps
Use the Test/Flow run time section to identify the slowest run. By clicking on the Slowest time, you can view the test output page for that specific test run and use the step timeline to identify steps that are taking a long time to execute. Here are a few different steps you can try to reduce run times.
Add context to slow steps with Configure Find
Some steps take a long time because mabl has little information upon which to locate elements. If the mabl Activity logs indicate that mabl consistently takes a long time to search for a given element, consider adding additional context with Configure Find. For more information on adding context to test steps, check out our guide on finding the correct element.
Update Configure Find values
If a step takes a long time and is already using Configure Find, check to see whether the Configure Find value is up-to-date. For example, if the step is configured to search for an element with a specific text, but the text of this element has been changed, mabl may be waiting a specified amount of time before auto-healing to the up-to-date version of the element.
Changing the Configure Find value to the current expected value can help reduce the time a step takes to complete.
Modify or remove wait steps
Wait steps are useful if you want to make sure an application is in a proper, actionable state. If your test includes many wait steps, understand why these wait steps exist. Depending on the reason, it may be possible to remove the wait steps and rely on Intelligent Wait, replace the wait step with a wait until step, or reduce the total wait time.
Remove unnecessary hovers
When you record hovers with the “record hovers” setting, mabl collects a large amount of hidden data and steps that may slow down the execution of your plans. You can speed up your test run by removing any unnecessary hover actions.
Iterate as needed
Optimizing tests and flows is a collaborative and retrospective exercise. During the process, you may identify other areas of your team’s workspace that could use improvement. For more information on reviewing your workspace as a team, check out this article on establishing a workspace review process.