Skip to main content

UI automation: Why “try, try again”is your mantra

Over the weekend, I was looking to book flights for holidays. All excited, I was able to find a decent price for my family to head for some sunshine later this summer. I reached the payment stage, and that’s where the excitement and smile stopped. I was waiting for confirmation that my payment was finalizing, but then the system took a turn, and I was back on the booking page. Even more, I now had a higher price to pay for the flights. Did I continue with booking, NOOOOOO. The website had let me down, taking away all the joy and excitement I had built up. I just shut the laptop and cried in a corner.  (#WillDamienGoOnHolidays)

UI automation promises efficiency, reliability, and a significant reduction in testing headaches. But let’s be honest, the road to seamless automation is not always smooth. If you have ever found your meticulously crafted test scripts failing unexpectedly, you’re not alone. In the world of UI automation, the phrase, “If at first you don’t succeed, try, try again,” isn’t just a cliché; it’s a fundamental principle.

The Unknown Reality of UI Automation

Why is UI automation so up and down, fail or pass? Applications themselves are not designed to be tested in traditional ways. Websites and applications are constantly changing, whether it’s being developed in React or some other framework, with elements shifting, IDs changing, and new features being deployed. This leads to unstable scripts and failed tests, but why, you ask?

  • Ever-changing shift in landscape: UI elements are not static; they change with updates and dynamic content.
  • Uncontrollable Environmental Variables: So many variables involved in testing, such as browser differences, operating systems, and network conditions, add layers of complexity.
  • External Influences: Third-party components can introduce unpredictable behavior.

Tests and test cases, manual or automated, are resilient. Here are a few practical tips to help you build more resilient UI automation:

  • Better ways of finding objects: Instead of relying on flaky IDs, use selectors that look at simple attributes.
  • Implement visual testing: Look at visual regressions by comparing screenshots of expected and actual UI states.
  • Leverage AI-powered tools: Examine AI-driven automation tools that can automatically adapt to UI changes.
  • Isolate your tests: If possible, test in a testing/staging environment to find problems in production.

Embracing the “Try, Try Again” Mindset

In life, we should never accept failure, but instead look to the old mantra, “try, try again.”  UI automation is a journey, much like life itself, with its ups and downs. However, by tweaking a test script here and there, or modifying an environment variable, each failure becomes an opportunity to learn.

From a testing perspective, where can we gain quick insights?

  • Define and refine object recognition: Use robust selectors like CSS or XPath that are less susceptible to change.
  • Implement explicit waits: Be patient! Use explicit waits to ensure elements are ready before interacting with them.
  • Retry methodology: Build in retry mechanisms to handle transient errors like network glitches.
  • Debugging is learning: Learn to analyze test logs and use debugging tools to pinpoint the root cause of failures. A successful day is not measured by how many tests you have passed but by what you learned from those failed tests.
  • Continuous improvement: Regularly review and update your scripts to keep them aligned with UI changes.
  • Try new technologies: With a no-code approach to automation, are we looking at visual testing? Can I offload to an on-demand platform to test without looking for machines from IT?

The Rewards of Persistence

While UI automation can be challenging, the rewards of persistence are immense. By embracing the “try, try again” philosophy, you build robust and reliable automation that reduces manual testing effort, speeds up release cycles, improves software quality, and even helps build team confidence in the automation process.

UI automation is a marathon, not a sprint. Today, we are in too much of a rush, and quality is suffering. Expect setbacks, learn from them, and keep refining your approach. Remember, every failed test is a step closer to “automation mastery.” So, the next time your script stumbles, take a deep breath and “try, try again.” You’ll be amazed at what you can achieve.

Websites and applications are sometimes not designed for testing. I hear that from time to time, and some customers make automation tools work even if they can get 60% automated. That’s more than they had before they started the process. If we can spend a bit more time being persistent with testing and debugging applications, fewer people like me will give up when things don’t work on the first try.

Will I be brave enough to try to book flights again?

The post UI automation: Why “try, try again”is your mantra appeared first on SD Times.



from SD Times https://ift.tt/kC1zBcZ

Comments

Popular posts from this blog

A guide to data integration tools

CData Software is a leader in data access and connectivity solutions. It specializes in the development of data drivers and data access technologies for real-time access to online or on-premise applications, databases and web APIs. The company is focused on bringing data connectivity capabilities natively into tools organizations already use. It also features ETL/ELT solutions, enterprise connectors, and data visualization. Matillion ’s data transformation software empowers customers to extract data from a wide number of sources, load it into their chosen cloud data warehouse (CDW) and transform that data from its siloed source state, into analytics-ready insights – prepared for advanced analytics, machine learning, and artificial intelligence use cases. Only Matillion is purpose-built for Snowflake, Amazon Redshift, Google BigQuery, and Microsoft Azure, enabling businesses to achieve new levels of simplicity, speed, scale, and savings. Trusted by companies of all sizes to meet...

Olive and NTT DATA Join Forces to Accelerate the Global Development and Deployment of AI Solutions

U.S.A., March 14, 2021 — Olive , the automation company creating the Internet of Healthcare, today announced an alliance with NTT DATA , a global digital business and IT services leader. The collaboration will fast track the creation of new healthcare solutions to transform the health experience for humans — both in the traditional healthcare setting and at home. As a member of Olive’s Deploy, Develop and Distribute Partnership Programs , NTT DATA is leveraging Olive’s open platform to innovate, build and distribute solutions to Olive’s customers, which include some of the country’s largest health providers. Olive and NTT DATA will co-develop new Loops — applications that work on Olive’s platform to provide humans real-time intelligence — and new machine learning and robotic process automation (RPA) models. NTT DATA and Olive will devote an early focus to enabling efficiencies in supply chain and IT, with other disciplines to follow. “This is an exciting period of growth at Olive, so...

2022: The year of hybrid work

Remote work was once considered a luxury to many, but in 2020, it became a necessity for a large portion of the workforce, as the scary and unknown COVID-19 virus sickened and even took the lives of so many people around the world.  Some workers were able to thrive in a remote setting, while others felt isolated and struggled to keep up a balance between their work and home lives. Last year saw the availability of life-saving vaccines, so companies were able to start having the conversation about what to do next. Should they keep everyone remote? Should they go back to working in the office full time? Or should they do something in between? Enter hybrid work, which offers a mix of the two. A Fall 2021 study conducted by Google revealed that over 75% of survey respondents expect hybrid work to become a standard practice within their organization within the next three years.  Thus, two years after the world abruptly shifted to widespread adoption of remote work, we are dec...