Wait-time issue in automation testing & How to handle it?

What is Wait?

A Wait is a tactic used in test automation scripts to create a pause in-between script steps as you wait for web elements to load or for an application to respond.

If there is no wait or a short wait between steps and the target web application needs longer time to load its elements, then the test will fail. This failure is due to the script rather than an error in the target application. And this failure is called false failure, and it should be avoided in the test script.

These are some common examples of what can cause a false failure:

  • False Fail: One of the biggest failures we see is when a script fails “false fail” due to waiting on the application. It is often caused by network latency, database requests, or simply the system needs more time to process and response to the request.

  • Targeted element not present on the page: This kind of failure occurs while waiting for elements to be displayed OR render in the browser. The application may be up and running but certain elements may not be loaded yet makes your test script failed.

How to address these failures related to Wait?

Instead of adding random 5-10 second waits for each step, you can try one of the following options:

  • Global variable – A global variable is a variable that has the global scope, meaning that it is visible throughout the program. You may consider defining 3 kind of global variables in your test scripts, with each for a short wait, a medium wait and a long wait. Use these variables in your test scripts according to the response time of your web application.

  • Wait for Page Load – This logic will wait for a page to completely load before running a step in your script.

  • Wait For Element Present – It happens sometimes that web elements take longer time to appear on the page when you are navigating through pages or clicking on buttons or doing something else. The “WaitForElementPresent” command will pause Selenium until the targeted element appears on the page. Once element appears, Selenium continues to execute the next command.

This script shows the usage of a global variable and Katalon Studio built-in keywords.

I’m using Katalon Studio and so far it seems to be a good and free solution to solve common automation problems. Hope these tips can help you handle the problems that are related to Wait-time issue.

Thank you for reading!

Views: 229

Reply to This

Replies to This Discussion

Thanks Joey,

It's very helpful. Just checking out the tool (Katalon Studio), already installed and starting making script.

I see a lot of future for this product.

Thanks for your post. I checked out the tool just a week ago but it totally astonished me. On the way to explore the tool, it would be great to see more information. By the way, for those who new to Katalon Studio (or you can say it's new to you), check out the tutorial videos on its Youtube channel and Raghav Pal's one. I think it would be easier for you to approach it.

RSS

Adverts

© 2017   Created by Rosie Sherry.   Powered by

Badges  |  Report an Issue  |  Terms of Service