What Is UTAM?
UI Test Automation Model (UTAM) is based on the popular Page Object model design pattern commonly used in Selenium tests. The page object design pattern uses an object-oriented class to decouple a test from the target web page for robustness and easier test maintenance. Instead of using an object-oriented class to write a page object, a UTAM page object is authored in JSON, and described by an easy-to-understand UTAM grammar. These JSON page objects are easy to write and easy to read.
Each web application page or component has a corresponding JSON page object that defines the UI interface for your tests. The UTAM compiler transforms the JSON page objects into JavaScript and Java page objects. You write your tests against the generated JavaScript or Java code. The JSON page object is the single source of truth for all your tests, no matter which testing language you use.
You can write your own page objects and use page objects created by other developers.
UTAM is easy to integrate with nearly any test automation framework. For JavaScript tests, UTAM provides an adapter between UTAM page objects and the browser API that WebdriverIO provides.
Why Use UTAM?
As a web application, such as Salesforce, changes from release to release, so does the DOM of the pages and components in the app. It is much less effort to update the UTAM page object for each changed component than it is to rewrite complicated UI automation tests. Using UTAM page objects reduces the testing time and pain every time an application UI changes.
At Salesforce, we plan to deliver UTAM page objects for each release. Each UTAM page object is a type. A page object can be composed of other page objects to match the composition of the application. The UTAM compiler generates methods that the test writer may chain to select elements.
UTAM relies on CSS selectors to avoid the need to use potentially problematic XPath locators. With UTAM, some tests are self-healing. If you refactor a component to add a div
or span
, simply update the JSON to match. As long as the page object's interface is the same, tests written against it still work.
UTAM also makes it easy to test components that implement Shadow DOM. The UTAM grammar lets you model a component's shadow DOM in a shadow
object. The UTAM compiler generates methods that cross the shadow boundary to select elements.
Who Is UTAM For?
UTAM is for the entire web developer and tester community. We plan to release UTAM as open-source software (OSS).
We’re already using UTAM at Salesforce to speed up UI testing. We hope you find it useful too!