# How Fathom Works

Fathom operates through a continuous AI-driven execution loop. Once a test intent is provided, the agent analyzes the application state at each step, determines the required action, and proceeds through the UI until the scenario is complete.

#### 1. Intent Interpretation

The user provides a natural language description of the test scenario. Fathom parses this intent to determine the sequence of actions required to fulfill the objective.

#### 2. Step-by-Step Execution

Fathom executes the test on the connected local emulator one step at a time. At each step, the agent:

1. Analyzes the current application state
2. Determines the next required action
3. Performs the interaction on the emulator UI
4. Advances to the next step

#### 3. Conditional Logic Detection

When the intent implies conditional behavior — for example, actions that depend on a specific application state — Fathom automatically identifies these conditions and represents them as IF blocks in the generated script.

This ensures the output script accurately reflects the dynamic behavior of the application rather than a single linear path.

#### 4. Validation Capture

If validation requirements are specified as part of the intent or provided during the run, Fathom captures them and appends the corresponding validation commands to the generated script.

Examples of captured validations:

1. Verifying the presence of a UI element
2. Confirming successful navigation to a screen
3. Checking for expected text or messages

#### 5. Script Generation

At the conclusion of a successful run, Fathom produces a structured test script containing:

1. The full sequence of UI actions performed
2. Conditional steps inferred from the intent
3. Validation commands (if defined)
4. Contextual navigation steps required to complete the flow
