What will you learn in this lecture?

In the previous video, we have learned why did the test fail. In this video, we will learn the answer to why the test is flaky.

Answer to Why the Test is Flaky

So, did you think about why the test failed the second time? Hopefully, you are able to figure it out. If not, no big deal. I’m going to tell you and explain to you exactly why that failed.

And the reason that it failed is a very standard, very common synchronization issue when you’re doing GUI functional tests automation. What happened with functional test automation is that your code is too fast for the browser.

The browser operates in seconds while your code operates in milliseconds. So the commands that are executed using the code are way too fast for the browser. And so that’s exactly what happened here so you can watch if I step over this line that’s going to click the purchase button and I’m gonna go ahead and step over here, what’s gonna happen is you gonna see this loading icon come up.

However, on the right-hand side, you can see that my Visual Studio is already in line number 35. And so it’s ready to execute the next statement which is an assertion to double check that the success element is displayed. And you can see it actually even told me that time that it took is 1258 milliseconds while you saw that the spinning icon was happening for multiple seconds.

And so that is the inherent problem of all GUI test automation as it stands right now is the synchronization problem. So this would have executed before this even finished loading on the left-hand side of the application. And so the purchase complete message would not have been there and so the test fails when it is executed real-time production environment.

The reason that it didn’t fail when we were debugging is that we took some time to step through it. Right? I clicked this and then I was talking to you and this finished loading and so then by the time I went to finish the assert, everything was completed successfully as it will do so now. So look if I do the assert, everything work successfully.

But when you run it in real time, that is one problem occurs as when those synchronization issues happen. It’s extremely common with Selenium webdriver and all GUI test automation framework. That’s why you need to have synchronization point and that’s why I am here to teach you implicit and explicit waits which I’m gonna cover over next.

Next Tutorial

In the next tutorial, you will learn about implicit wait.

What will you learn in this course?

Are your automated functional tests flaky? Do they randomly fail and you are unsure why? Is your team frustrated with the “instability” of your Selenium Webdriver tests?

If you are interested in fixing all of these problems and making your tests more stable, then you need to understand how to use all of the different types of waits in Selenium Webdriver. Knowing how to handle synchronization issues will make you a top-notch Test Engineer!

“The best tutorials I have ever seen, simply awesome. I take off my hat in front of you, you are a gorgeous professor, I am speechless to express how satisfied I am with these tutorials.”¬†-Lisbey

In this course from Ultimate QA, you will learn:

– Learn the problems that can occur as a result of improper synchronization.

–¬†Learn how to use Selenium Webdriver explicit waits.

– Master Selenium Webdriver implicit waits

– Understand what a DefaultWait is

– Comprehend how to use all of the different types of waits during appropriate situations

Take This Entire Course for Free

Nikolay Advolodkin is a self-driven SDET on a lifelong mission to create profound change in the IT world and ultimately leave a legacy for his loved ones, community, and the world at large. Today, he serves as the CEO and Test Automation Instructor at UltimateQA.com and contributes informative articles to leading test automaton websites like SimpleProgrammer.com and TechBeacon.com

Pin It on Pinterest

Shares
Share This