רשומות

מציג פוסטים מתאריך מרץ, 2019

Stop using time.sleep everywhere!

תמונה
I think that almost every automation infrastructure that I have seen has the time.sleep() method at least once. Sometimes it comes from laziness and sometimes from a lack of knowledge, but I believe that in at least 90% of the times, sleep methods should not appear in our code. Why do we need the sleep method at all? In the e2e automation world, when we try to automate the AUT (application under test), we sometimes depend on processes we do not control. For example, as automation developers, when we click on a button to switch pages in the AUT, we don't have control on the pace that the new page is loaded, it depends on many variables like the network speed and communication with third party systems (like databases and servers). When the automation developer starts an operation that can take time (like the page loading in the example) and continues his test flow right after, the test may fail due to missing information of the application. for example, if we try