> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spurtest.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Caching Tests

> Cache test results for faster subsequent test runs and improved execution efficiency.

## Enable Caching

When creating or editing a test, locate the **Advanced Configurations** section and check the **Cached** checkbox under it.

<Frame>
  <img src="https://mintcdn.com/spur/4nwpEE0-cgs18aCd/images/Screenshot2026-02-02at6.25.41PM.png?fit=max&auto=format&n=4nwpEE0-cgs18aCd&q=85&s=795ebde08151170743250cf5fae3d21b" alt="Screenshot 2026 02 02 At 6 25 41 PM" width="1134" height="176" data-path="images/Screenshot2026-02-02at6.25.41PM.png" />
</Frame>

To disable caching, simply uncheck the box. By default, tests are not cached.

## How Caching Works

When caching is enabled, the Spur Agent stores successful test execution data. On subsequent runs, cached results are reused when test configuration remains unchanged, significantly reducing execution time and resource consumption.

**Benefits:**

* Faster test execution for unchanged tests
* Reduced load on testing infrastructure
* More efficient use of test run quotas

## When to Cache Tests

Caching accelerates tests with stable early steps, but becomes counterproductive when variability occurs early in the sequence.

### When Caching Works Well

<Columns cols={2}>
  <Card title="Stable setup followed by variable steps">
    Tests with consistent initial sequences (login, navigation, data preparation) followed by randomization later benefit most.
  </Card>

  <Card title="Minimal expected changes">
    Cache tests when you anticipate few changes to cached steps and have confirmed test stability through at least one successful run.
  </Card>
</Columns>

### When NOT to Cache

<Columns cols={2}>
  <Card title="Early randomization">
    Random elements in early steps (such as product selection at step 2) create cascading changes through subsequent steps, preventing cache hits entirely.
  </Card>

  <Card title="High variability throughout">
    Tests with multiple random or dynamic elements become slower with caching enabled. Poor caching strategy adds overhead from failed cache attempts while still requiring full execution.
  </Card>
</Columns>

### Key Decision Point

Identify where variability begins in your test sequence. Early variability makes caching counterproductive; late variability maximizes cache efficiency.

## Editing a Test After a Cached Run

Caching automatically manages edited tests and steps. When you edit a test after a cached run, the Spur Agent successfully invalidates the cache and runs the test with fresh execution. This ensures your changes are properly validated without manual cache clearing.
