Skip to main content
Use soft assertions to check several independent expectations in one stable page state. A failed soft assertion records a failure and lets later steps run; the completed test still fails.

Check a page without stopping at the first mismatch

Keep prerequisite checks hard so their failures stop execution. This example checks independent expectations after confirming that the expected product loaded and the image and size selector are visible:
product-details.test.yaml
Replace the URL and expectations with those for your app. If either prerequisite check fails, execution stops before the independent checks. If the stock status check fails, the button, description, and layout checks can still run. A passing last step doesn’t erase an earlier soft failure.

Enable soft assertions

Use soft assertions for browser AI checks and element checks. Mobile tests don’t support them. Other browser steps, including JavaScript, page checks, and actions, remain hard. Use momentic@3.65.0 or later for all the examples on this page. Soft AI assertions require momentic@3.64.0 or later; soft element checks require momentic@3.65.0. To update an older project, use momentic upgrade from the project root. Start from a clean, backed-up working tree and preview the changes:
Review the preview, then apply the upgrade:
The command updates the installed CLI and recommended configuration and can convert legacy YAML files. The preview requires authentication with a saved login or an API key. It doesn’t run tests. See the upgrade procedure for configuration changes and recovery from a partial upgrade.

In the local editor

Select an AI check or Element check step. In its detail panel, turn on Soft assertion. Leave the switch off for prerequisites. For a screenshot-only AI check, choose Screenshot only under AI context mode. Run the whole test or select a range that includes the checks you want to collect. Running a single soft check executes only that step; it doesn’t start the rest of the test. Soft assertions don’t extend a selected range or override stopping the run.

In YAML

Change the command name, not the payload. The soft command takes the same parameters as its hard counterpart, including timeout and retries. The element-check rule includes negated checks and checks on content, attributes, tag names, and styles. For example, checkElementNotVisible becomes softCheckElementNotVisible, and checkElementAttributeDoesNotContain becomes softCheckElementAttributeDoesNotContain. Keep the existing element or css target and any name and value fields.
Don’t add soft: true to a hard command in YAML. Use the soft alias. Soft assertions can appear as ordinary steps in tests, modules, and conditional or loop bodies, but can’t serve as if or while predicates. The editor doesn’t show the switch on those predicates or an AI action’s embedded success check.

Decide which checks should continue

Use soft assertions when one failed expectation leaves the others meaningful:
  • Check independent content, layout, and control states after the expected page has loaded.
  • Collect several mismatches on a settings page without losing evidence from checks later in the test.
  • Add independent validations after hard login, navigation, or setup checks.
Keep a check hard when later work relies on it. Login, navigation, loading the right record, and creating test data are prerequisites. If they fail, continuing can produce unrelated failures against the wrong page or stale data. Action failures remain hard. Soft assertions don’t make a failed click safe to continue. Don’t use soft assertions to hide flaky checks, accept ignored failures as passing, or collect a chain of failures caused by one missing prerequisite. Fix the timing or dependency instead. For a custom HTML media player, use element checks for control state, such as a button’s aria-pressed attribute. Use AI checks when the expectation needs semantic or visual judgment, not to obtain soft behavior. A pause icon alone doesn’t prove playback stopped. Verify playback effects separately; a JavaScript check on media state doesn’t gain soft continuation from these aliases.

Timeouts, retries, and stopping

Soft assertions change what happens after a failed check, not how it waits or retries. timeout remains milliseconds in YAML. Momentic applies explicit step retries before continuing past a failed check. In the example above, Momentic waits up to 10 seconds for the AI assertion and retries the step once if it fails. A check that succeeds on retry isn’t listed as a failed soft assertion in the final report. Only assertion verdict failures continue. Provider errors, browser errors, ambiguous selectors, cancellation, and other execution failures remain hard. A missing element can be a failed soft expectation; an invalid or ambiguous selector is not. Soft failures don’t invoke failure recovery. Setup and teardown are separate from soft continuation. A hard setup failure skips the main steps. A soft setup failure allows them to run but still fails the test, so keep required setup hard. Teardown runs after main steps pass or fail during a whole-test run; it isn’t a way to continue the main body after a hard failure. A continuous integration (CI) system’s continue-on-failure setting controls what that system does after the command fails. It doesn’t make an assertion soft or change the test’s failed result.

Read the failures

Failed soft checks retain FAIL on their step cards, including in uploaded local runs. Inspect each failed step for its expectation and evidence rather than treating the last step’s status as the test result. When a local CLI run completes without a hard failure, its final report lists the failed soft assertions with YAML context. If a later hard failure stops the test, that failure takes precedence in the final CLI report; earlier soft checks remain failed on their step cards. A cancelled run is interrupted, not a completed soft-failure run. Soft assertions don’t make the test pass or suppress its failed status. Separate quarantine and classification options can affect the process exit code; they don’t change what a soft assertion means.