UI Test Automation Model (UTAM)

UTAM, or the UI Test Automation Model, is a popular page object model design pattern used for UI tests. It relies on a CSS selector to avoid using complicated Xpath locators and is authored in JSON using the easy-to-understand UTAM JSON Grammar. The UTAM generator converts HTML files into UTAM JSON, which is then provided to the UTAM compiler to convert the JSON into executable code in JavaScript, TypeScript, and Java.

Why do we need UTAM?

Simplicity - UTAM relies on a CSS selector to avoid using complicated Xpath locators.

Affordability - UTAM is an open-source tool that is available at no cost, whereas other tools and suites with similar features often require payment.

Efficiency - The time required to run complex scenarios is comparatively less when using UTAM, as its DOM interaction is very quick. This results in lower time complexity for testing larger numbers of scenarios.

Compatibility - UTAM provides extended support through its "UTAM Chrome Extension," which allows users to check which page objects and methods can be utilized to automate the currently opened page on the browser.

Flexibility - UTAM allows for testing of features and functionalities that cannot be covered through a test class.

Productivity Boost - By utilizing UTAM, a single automation resource is capable of writing 4-7 complex scenarios per day, which is not feasible with other frameworks due to the time-consuming task of finding locators. This ultimately leads to reduced resource requirements and increased profitability.

Adoption - Many big firms have already adopted and implemented the UTAM framework, and have begun training their resources on it. They see this solution as the future of Salesforce testing.

Benefits over existing solutions

Dynamic DOM Handling

Salesforce is an application that undergoes changes with each release, which can impact the existing DOM of Salesforce pages and components. In salesforce test automation, changes in the DOM structure can cause test scripts to fail, as they interact with the elements present on the DOM. For frameworks such as Selenium and Protractor, changing element locators manually can be time-consuming and repetitive work. However, UTAM simplifies this task by providing updated page objects for every release. To incorporate these changes into our repository, all we need to do is run the update command.

Shadow DOM Simplified

Testing components that implement shadow DOM can be challenging for frameworks like Selenium and Protractor, as interacting with such elements often requires the use of long Xpaths, which can be tedious and error-prone. However, with the use of UTAM, an open-source tool that provides extended support and relies on CSS selectors, testing these components becomes easier and less complicated.

Automated Conversion

In other tools, we need to manually write JSON for the given HTML code. However, with UTAM's generator, we can convert HTML code into UTAM JSON and then pass it to the UTAM compiler, which will convert it into executable JavaScript, TypeScript, and Java code.

Limitations

  • UTAM is a relatively new test automation model in the market and therefore, it does not yet have a very wide support and community. However, with time, more and more people are getting to know about this model and showing their interest in it.

  • The UTAM model is still under development by Salesforce, so it may have some minor and medium-level issues which they are continuously working to resolve.

  • While training novice-level resources on UTAM, you may encounter some difficulties initially. However, as you delve deeper into the framework, you may find it easier to use compared to other tools.

Abhinav Gupta

First Indian Salesforce MVP, rewarded Eight times in a row, has been blogging about Salesforce, Cloud, AI, & Web3 since 2011. Founded 1st Salesforce Dreamin event in India, called “Jaipur Dev Fest”. A seasoned speaker at Dreamforce, Dreamin events, & local meets. Author of many popular GitHub repos featured in official Salesforce blogs, newsletters, and books.

https://abhinav.fyi
Previous
Previous

The Benefits of Hiring a Salesforce Consulting Partner

Next
Next

Einstein Recommendation Builder - Patient Fever Treatment (Healthcare Demo Video)