# App-Level Test Stage Configuration

At the Application level, SeaLights provides a centralized configuration interface to define how Test Optimization behaves across your project. This configuration allows teams to balance testing speed with data integrity by automating the selection of tests, defining fallback policies for full test runs, and streamlining the onboarding of new branches.

<figure><img src="/files/BUzWk2UmyH9x8VVsH8yU" alt=""><figcaption></figcaption></figure>

### Default Configurations

To eliminate manual overhead, SeaLights allows you to set global defaults for your application. When a developer creates a new branch (e.g., a feature or bug-fix branch), the system automatically inherits these settings and ensures consistent testing practices across your codebase. .

* **Auto-Enable Test Optimization:** Determine if Test Optimization (TIA) should be active by default for all new branches.
* **Inherited Frequency:** Define how often a full regression should occur on new branches without manual intervention.

### Recommendation Modes

SeaLights offers two distinct logic engines for determining which tests should run. Choosing the right one depends on your build frequency and CI architecture.

#### **Build-Based Recommendations**

In this mode, the set of recommended tests is tied directly to the **Build ID**.

* **Behavior:** If you run the same build three times, SeaLights will recommend the same set of tests each time.
* **Use Case:** Best for environments where a build is considered a "static snapshot" and you want to ensure the exact same impact analysis is applied regardless of how many times the stage is triggered.
* **Note:** This may lead to redundant executions if you frequently re-run builds where tests have already passed.

#### **Test Cycle-Based Recommendations**

This mode shifts the focus to the **Test Stage Cycle** within a build.

* **Behavior:** Recommendations are dynamic. If a test passes in the first run of a build, it is excluded from the next run of the *same* build. It focuses only on tests that failed or were skipped in previous cycles.
* **Use Case:** Highly recommended for flaky test management or pipelines that require multiple "retries" to achieve a clean state without wasting time on already-verified code.

### Test Optimization on Pull Requests

The system analyzes code changes within a pull request and determines which tests are impacted. Only these affected tests are executed, optimizing test efficiency. To leverage this feature, integrate your CI/CD pipeline with SeaLights to trigger the desired test stages as part of the pull request process.

### Full Run Policy

While Test Optimization is efficient, periodic full regression runs are essential to maintain the "Source of Truth" for your test map and to ensure no edge cases are missed over time.

* **Scheduling:** You can define a Full Run Policy based on:
  * **Time:** Daily, Weekly, or Monthly.
  * **Activity:** Every **X** number of runs (e.g., every 10th run is a full run), or On-Demand.
* **Persistence:** This policy ensures that even if Test Optimization is always enabled, the system "cleanses" its data regularly to maintain high accuracy.

### Manual Full Run Trigger

Users always have the "override" capability. If a critical change is made or if a release candidate requires maximum confidence, a **Manual Full Run** can be initiated.

* **Behavior:** The system executes 100% of the test suite.
* **Post-Run Logic:** Once the manual run is complete, SeaLights automatically reverts to the scheduled Full Run Policy for subsequent executions.

***

### FAQ

<details>

<summary><strong>If I change the App-Level default settings, will it affect existing branches?</strong></summary>

Default configurations typically apply to *new* branches created after the setting is saved. Existing branches may require manual updates if you wish to change their specific TIA behavior.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealights.io/knowledgebase/test-optimization/test-optimization-strategy/enabling-test-optimization/tia-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
