Skip to main content
Goal-based tests describe the product outcome a user must reach without fixing the test to one sequence of interactions. They work best when the outcome is stable but the path can change. An AI action is how Momentic executes a goal-based step. It divides the goal into sub-goals, observes the current page or screen, executes the next steps, and evaluates the result. It repeats this process until the overall goal is complete. If a product bug or fatal execution error prevents the next sub-goal, the action stops and reports the blocker. It also stops if it exhausts its execution budget. Use a string for a straightforward goal. Use act: when the action needs a precondition, postcondition, cache control, or other step options.
checkout.test.yaml

Write bounded goals

A strong goal has one user intent, enough context to remove ambiguity, and a clear stopping point.
  • Prefer Add the cheapest in-stock blanket to the cart and open checkout.
  • Avoid Browse the store and make sure everything works.
  • Include data constraints that matter, such as using a fresh email or choosing an in-stock item.
  • Split a long test by user outcome instead of asking one goal to cover an entire product journey.
If the flow must repeat, state a finite bound or use a while loop with maxIterations.

Postconditions

The goal tells the AI action what to accomplish. A postcondition defines the product state that must be true before the action can pass. Add one to every meaningful or state-changing AI action:
Describe a durable outcome, not a brief animation, spinner, or toast. Use a standalone assertion or element check when the checkpoint is independent of the AI action. For transient web UI, use a run assertion.

Caching

After a successful run, Momentic caches the steps generated by the AI action. Later runs replay that path instead of planning it again, making repeated runs faster and more consistent. If the cached path no longer works, failure recovery clears the cache so the action can plan a new path. Set cache: false when the route should be planned again on every run:
The shorthand and explicit forms use the same cache behavior. See Step caching for cache invalidation, branching, and failure recovery.

Choose the right level of control

Use an AI action when the outcome matters more than the exact interactions. Use a preset step when the interaction itself is part of the behavior under test. These forms can coexist in one test. For example, an AI action can navigate a checkout flow while a preset step verifies a specific consent control and the postcondition verifies the final order.

Knowledge base integration

Use the Knowledge base to give every AI action consistent product context:
  • Add Terminology entries for product-specific names, internal aliases, and words that have a special meaning in your interface.
  • Add an Agent rule for the AI action agent when it should follow an organization-wide interaction convention or expected product behavior.
  • Add a Flow when a reusable journey has a known sequence and success state.
AI actions retrieve relevant approved knowledge before they start and can look up more context while they run. When an action discovers a reusable term or flow that is not already captured, it can suggest a Knowledge base entry. The suggestion stays inactive until someone reviews and approves it, so future AI actions learn from shared product knowledge without silently changing global behavior.