Converging Test Automation and UIs

by Dmitry Kirsanov 5. December 2023 04:00

Software testing has undergone a dramatic evolution over the years. It has metamorphosed from mundane, manual tasks to a truly dynamic and automated process. Specifically noteworthy is the potent concept of automated testing via the user interface(UI) realized through the advent of profoundly adept modern technologies.

In contrast to traditional unit tests that primarily perforate lines of code and evaluate their intended functionality, automated tests foster interaction and inspection of the application in its full glory. They robustly scrutinize the complete assembled system via its UI. Consider the tests as an intrepid globetrotter, navigating through the labyrinth of web applications, smart devices, virtually or physically, Android or Apple. The main idea is to simulate real user interactions and accurately replicate user experience.

Running Automated Tests: A Game Changer

I personally categorize these automated tests as "through-the-UI tests." Their enactment necessitates the entire application to be deployed, distinguishing them from unit tests that target only the UI code. Widely acknowledged industry jargons like end-to-end tests often sum up their essence adequately, albeit not in all circumstances. We must keep in mind that some applications exclusively function as a service and technically lack a UI, hence an end-to-end test may not typically encompass these.

Automated Testing Case Study: An In-depth Analysis

For example, we'll use a web application underpinned by a Java backend simulating the process of prescribing medications. This application features a specific rule limiting the prescription duration of certain classes of medication such as opioids and benzodiazepines to no more than thirty days. Any attempt beyond the predefined interval triggers a warning message, effectively blocking the prescription process.

A running instance of this application is subjected to an automated test of this business rule via a URL. The test utilizes driver libraries, provided by Selenium, for automated browser interaction, with JUnit facilitating the test execution. Contrary to what one might infer, these tests are not unit tests, but web driver executions, literally interacting and interpreting the UI components like a real user would.

The Challenges and Evolution of Testing

How does automated UI testing fit into the proverbial "test pyramid" that we often refer to? You may wonder: "Should the majority of tests focus on the user interface?" The answer may surprise you.

Firstly, the landscape has changed monumentally since the inception of the test pyramid concept. The proliferation of devices and diverse screen sizes amplified the test space exponentially. The reality of today’s applications being accessible from desktops, tablets, and smartphones is a daunting challenge by itself. This Herculean task is further amplified when applications spawn multiple native front-ends for various smart devices. Enter modern cloud vendors. They provide a gamut of services, including virtual and physical devices and parallelism, to cater to our diverse testing needs.

Real-World Impact and Value of UI Testing

Automated UI tests offer some undeniable advantages. Yes, they might be slower than conventional tests, but they comprehensively evaluate large parts of the system under test. For an application supporting multiple device types, they are indispensable. This approach may seem overused and arguably not the perfect fit in all scenarios, such as when focusing on complex back-end business logic. But, the use cases where it delivers invaluable insights are substantial.

Seamlessly blending technology and strategy, automated testing through the UI is a compelling paradigm shift. Just remember: deliberate, purpose-driven testing always prevails. From unravelling nuanced insights about your application to enhancing the user experience, automated UI testing etches a place for itself in the pantheon of software testing approaches.



blog comments powered by Disqus