Testing apps is vital to make sure that they’re of top-notch high quality. And to check purposes, one sort of testing you possibly can belief is end-to-end (E2E) exams.
E2E exams are executed with an automated UI testing instrument like Selenium or WebdriverIO. The USP of E2E exams is that you would be able to:
- Use an actual browser to work together with parts and navigate throughout screens once you execute take a look at situations.
- Take a look at an app with restricted entry to its supply code.
Nonetheless, writing E2E exams, testing your UI completely, and avoiding repetitive handbook testing is not any straightforward feat. Typically you’ll end up investing in third-party instruments and options to put in writing and keep E2E exams.
Enter – a brand new UI take a look at automation framework by Salesforce – UI Take a look at Automation Mannequin (UTAM).
So, what’s UTAM? Why use UTAM? The right way to run exams with UTAM?
Learn on to study the solutions to all these questions and extra.
With the Salesforce Spring ‘22 launch, UTAM turned typically obtainable.
UTAM adopts the Web page Object Mannequin design sample related to Selenium, taking Web page Objects to the subsequent stage by creating abstractions of Web page Parts, permitting for strong UI testing.
It doesn’t change a UI testing instrument however dietary supplements it by decoupling the take a look at code from the Doc Object Mannequin (DOM) utilizing Web page Objects.
UTAM Web page Objects can describe a internet web page itself or a internet element at a granular stage.
Do not forget to take a look at: What is Case Automation Tool in Salesforce
Why Use UTAM?
UTAM dissociates a take a look at case from an online web page or an online element, this helps to extend the take a look at robustness, and scale back the associated fee & complexity of take a look at case upkeep as a result of Salesforce modifications DOM after each launch. Due to this, the UTAM element definitions might require code modifications, permitting the take a look at case(s) to be unchanged and accordingly offering separation of issues:
- Lower duplication of Net Parts/Web page Objects and supply particular person reusable UTAM parts which are simpler to keep up.
- Guarantee every UTAM element is expounded to a person set of cohesive tasks. Additionally, examine that it’s linked to a single internet element for higher stability and maintainability.
- Enhance maintainability to help customized Lightning Net Parts.
- Execute a take a look at case utilizing Selenium or WebDriver.io take a look at automation frameworks.
- Be used for each Salesforce and non-Salesforce internet pages.
You possibly can write UTAM Web page Objects in JSON. Additionally, Web page Objects act as a shareable contract and are written in JSON. This makes UTAM distinctive from different UI testing instruments. Merely put, UTAM allows a number of groups to collaborate and share Web page Objects whatever the expertise they use for testing.
Operating Finish-to-Finish Exams With UTAM
Now that we’ve coated what UTAM is and the way it helps, let’s take a look at a sensible instance.
Right here, we’re testing a static HTML web page with “Hi there, World!” as show:
Try the steps wanted to check this web page:
- Declare a JSON Web page Object with a world component. This component consists of a .world CSS class selector, in alignment with a DOM component on the web page underneath take a look at.
- Compile Web page Object, which generates a category with a getWorld technique that’s tied to the world component outlined in JSON.
- Use the getWorld technique from the compiled Web page Object within the take a look at code to get entry to the content material of the DOM with the .world CSS class.
Whereas this may increasingly appear long-winded for a easy use case, the true energy of UTAM is obvious when the pages are advanced. In advanced circumstances (that are nearer to real-life apps), composition and reusability are essential, and that’s the place UTAM helps.
UTAM will not be restricted to testing Salesforce apps; it may be used with any expertise or platform. However Salesforce supplies a set of a whole lot of reusable UTAM Web page Objects for the bottom Lightning Parts and the Lightning Expertise. This protects loads of time when writing E2E exams for Salesforce apps. That’s why most Salesforce engineering groups use the ability of UTAM internally to check their apps.
Need to stage up your testing recreation with UTAM? Discuss to us!