This test step checks the values or attributes of a UI field and compares them to the expected values. This is most useful for when fields on a UI need to have their values and/or behavior checked in a functional testing flow. This test step can also be used to check messages on a page, using a Page Assertion, or values in a column, using a Column Assertion.
It is often best to add this test step through the Test Builder by mapping the field and selecting an Interaction Type of Read/Assert. This is recommended as the fastest way to add this kind of test step, although it is also possible to use drag-and-drop from the Test Palette.
A UI Assert can test the following:
- Field values
- Field attributes (e.g., Read Only, Visible)
- Messages thrown on operations like Save (e.g., validation rule error messages, page-wide messages)
- Column header names in tables (e.g., a related list)
- Column values
- Count or number of items in a column
Adding multiple asserts
Note that more than one Assert can be added to a single test step, providing that the Asserts are all of the same type (see Asserting Fields vs. Asserting Fields in Tables below). The best method for doing this is to use the icons identified below.
If multiple Asserts are used in the same test step, the result of the assertions will be stored in a list.
Asserting standalone fields vs. asserting fields in tables
In this example, the Assert checks a specific validation error message for the Account Number field. The expected message is defined precisely, and it is Case Sensitive.
In addition, this Assert will also Read whether the field is Visible and will check that the field equals Read Only. Note the difference between Read (to capture an attribute and place it in a Results variable) and Equals (to test for a specific attribute condition and return TRUE or FALSE).
The full Field Assertion attributes are as follows:
- Field: The name of the field to be asserted. This will be auto populated based on the UI On Screen or UI With Row parent Test Step
- Value: Defines any expected field value
- Message: Defines any expected validation message against the field (e.g., after Save is clicked)
- Visible: Checks whether the field is visible on the page layout (based on the permissions associated with the user credentials through which the Salesforce Connection has been made)
- Disabled: Checks whether the field is disabled or enabled
- Read Only: Checks whether the field is Read-Only or Editable
- Focused: Checks whether the tab focus is on the current field
- Inline Editable: Checks whether the field can be ‘inline edited’, i.e., editable from the View screen without navigating to the full Edit screen
- In View: Checks whether the field is visible onscreen without scrolling based on the current browser size
- Options: Checks the metadata options available for the field (applies to picklist fields only)
Note that these parameters are optional except for Field. The other parameters will appear when selected from Test Builder or when clicking the Add the Field Assertion Attributes located in the Test step parameters.
The full list of operators is as follows:
- Ignore: Shows that an attribute should not be checked
- Read: Captures the attribute and places it in a Results variable
- Equals: Checks an attribute against an expected string (returns TRUE or FALSE)
- Contains: Checks whether the attribute includes a defined value-string within it (returns TRUE or FALSE)
- Starts with: Checks whether the attribute begins with a defined value-string (returns TRUE or FALSE)
- Ends with: Checks whether the attribute ends with a defined value-string (returns TRUE or FALSE)
- Matches: Matches the attribute value with a defined value-string (returns TRUE or FALSE)
To test messages on a page, a Page Assertion can be used. This will capture all messages in a list, which can then be checked against a defined string value.
A Column Assertion can be used to test the attributes or values of a column within a table. This has the following parameters:
- Column: The Name of the Column which should be asserted. This will auto-populate based on the table captured in the UI On Screen or UI With Row parent test step.
- Column Values: Reads the number and values of all the column items and adds them to a list.
- Column Visible: Check whether the column can be seen on the page layout.
- Heading Text: Compares the column’s title against a defined string value.
Note that Column Values, Column Visible, and Heading Text can be set to Ignore if they are irrelevant to the scenario. For example, it may be necessary only to test whether the column is visible or has a specific title.
Example: Asserting fields
In this example, the UI Assert test step is used to assert the value and some attributes of the Account Name field and the Type picklist field.
Step 1: The Test Builder is launched, and a specific Account record is navigated.
Step 2: The Account Name is mapped as a test step by right-clicking on the field and selecting Add to Test Case.
Step 3: The Draft test step is configured as follows:
Note that the Expected Attributes section will not be visible in Test Builder for some Provar versions. These attributes can be configured within Provar Desktop once the test step has been added.
The Extract Value and Assert Value checkboxes are both ticked. The Expected Value is set to the name of the Account (Test Builder will generally prefill this, but the value can be changed as wanted).
Note: The information gathered in the Assert is visible in the Test Runner and the Variables view for each test step. The Values variable demonstrates the values collected through the Account Name Assert.
The execution results are also visible in the Test Builder by right-clicking on a given step and selecting View Test Step Output.
Step 6: To complete the test steps, you can rename the UI Assert step so that their purpose can be easily understood.
- Provar Automation
- Installing Provar Automation
- Updating Provar Automation
- Using Provar Automation
- API Testing
- Behavior-Driven Development
- Creating and Importing Projects
- Creating Test Cases
- Custom Table Mapping
- Debugging Tests
- Defining a Namespace Prefix on a Connection
- Defining Proxy Settings
- Environment Management
- Exporting Test Cases into a PDF
- Exporting Test Projects
- Override Auto-Retry for Test Step
- Managing Test Steps
- Namespace Org Testing
- Provar Desktop
- Provar Test Builder
- Refresh and Recompile
- Reintroduction of CLI License Check
- Reload Org Cache
- Running Tests
- Searching Provar with Find Usages
- Secrets Management and Encryption
- Setup and Teardown Test Cases
- Tags and Service Level Agreements (SLAs)
- Test Cycles
- Test Plans
- Testing Browser Options
- Tooltip Testing
- Using the Test Palette
- Test Palette Introduction
- Control Test Steps
- Generate Test Case
- List Compare
- Page Object Cleaner
- Read Test Step
- String Test Steps
- UI Test Steps
- Using Custom APIs
- Callable Tests
- Data-Driven Testing
- Page Objects
- Block Locator Strategies
- Introduction to XPaths
- Creating an XPath
- Label Locator Strategies
- Maintaining Page Objects
- Mapping Non-Salesforce fields
- Page Object Operations
- Refresh and Reselect Field Locators in Test Builder
- Using Java Method Annotations for Custom Objects
- Applications Testing
- Database Testing
- Document Testing
- Email Testing
- Mobile Testing
- OrchestraCMS Testing
- Guide in Salesforce CPQ Testing in Automation
- Guide in ServiceMax Testing
- Skuid Testing
- Vlocity API Testing
- Webservices Testing
- Provar Manager
- Introduction to Test Scheduling
- Apache Ant
- Configuration for Sending Emails via the Automation Command Line Interface
- Continuous Integration
- AutoRABIT Salesforce DevOps in Provar Test
- Azure DevOps
- Running a Provar CI Task in Azure DevOps Pipelines
- Configuring the Automation secrets password in Microsoft Azure Pipelines
- Parallel Execution in Microsoft Azure Pipelines using Multiple build.xml Files
- Parallel Execution in Microsoft Azure Pipelines using Targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- Gearset DevOps CI/CD
- GitHub Actions
- Integrating GitHub Actions CI to Run Automation CI Task
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using Multiple build.xml Files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab Continuous Integration
- Travis CI
- Execution Environment Security Configuration
- Provar Jenkins Plugin
- Parallel Execution
- Running Provar on Linux
- Salesforce DX
- Team Foundation Server
- Version Control
- Salesforce Testing
- Adding a Salesforce Connection
- Assert Page Error Messages on Add/Edit Product
- Internationalization Support
- List and Table Testing
- Salesforce Console Testing
- Salesforce Lightning Testing
- Salesforce Lightning Web Component (LWC) Locator Support
- Salesforce Release Updates
- Visualforce Testing
- Best Practices
- Configurations and Permissions
- Error Messages
- Licensing, Installation and Firewalls
- Test Builder and Test Cases
- Release Notes