# Test Data and Generation Setup

> Upload sample Excel/CSV data so generated tests use realistic inputs, then check generation readiness per endpoint and tune request/response mapping overrides.

Source: https://totalshiftleft.ai/help-center/product-documentation/test-data-and-generation-setup

## Overview

Two Rule Intelligence tabs prepare inputs for test generation: **Data for Generating Tests** turns sample spreadsheets into **fixtures**, and **Generation Setup** shows generation readiness per endpoint and lets you override how those fixture fields map into requests and assertions. Background: [Understanding Rule Intelligence](/help-center/product-documentation/understanding-rule-intelligence).

## Before you begin

- Open the workspace (project editor → **Requirements** tab, or the standalone Rule Intelligence hub → select a project), then click the **Data for Generating Tests** tab.
- The header reads **Data for Generating Tests** with the note *"Sample data used when generating tests. Upload Excel, CSV, or other files — their values are parsed into fixtures so generated tests use realistic inputs. (For data used when running tests, see Project Settings → Data for Running Tests / Datasets.)"*
- This is sample data for **generating** tests. To iterate a test over rows of data at **run** time, use [Data-driven testing](/help-center/product-documentation/data-driven-testing) instead.

## Step 1 — Upload sample data

1. On **Data for Generating Tests**, click **Choose test data files**.
2. Select your files. On success you get a **Test data uploaded** (or **N test data file(s) uploaded**) confirmation.
3. Each file lands as a row with columns **Name**, **Type**, **Status**, **Created**, and **Actions**. Test-data rows use simpler status labels than requirement docs: **Uploaded**, **Ready**, **Parsing Queued**, **Parsing**, **Parsed**, **Failed**.

If nothing is uploaded yet, the empty state notes *"Supported: Excel, CSV, JSON, YAML, and other common data formats."*

## Step 2 — Extract test scenarios

For an **Excel** or **CSV** row, the **Actions** cell shows an **Extract test scenarios from file** button (table-cells icon). Click it to parse the spreadsheet into scenarios and persist them as fixtures.

On completion you get a confirmation such as *"N scenario(s) extracted; N row(s) persisted for TestCompiler,"* and a **Test Data Preview** panel opens.

## Step 3 — Read the Test Data Preview

The **Test Data Preview** panel reports:

- *N scenario(s) extracted.*
- *N scenario row(s) persisted for deterministic test generation (idempotent upsert)* — persisted rows feed the generator directly.
- *N dataset(s) created — happy-path tests will iterate these rows automatically*, when datasets were produced.
- A reminder: *"Mapping overrides for these rows live in the Generation Setup tab."*

Scenarios are grouped **by sheet**, one card per sheet, headed **Sheet: <name>** with a *N rows · N columns* count. Each card is a table: a **#** column, a **Scenario** column, and one column per request/response field so you can see the actual values. Re-run **Extract test scenarios** any time; persistence is an idempotent upsert, so it won't duplicate rows.

## Step 4 — Check generation readiness

Switch to the **Generation Setup** tab. Its header explains: *"Preview generation coverage per endpoint and (optionally) override how uploaded fixture fields map into requests, parameters, and assertions. Auto-inference applies when no override is saved."*

In the **Generation readiness (endpoint)** card:

1. Pick an endpoint from the **Select endpoint…** dropdown.
2. Click **Preview coverage**.

The result reports, for that endpoint:

- **Approved requirements (project)** and how many are **Applicable to endpoint**.
- **Persisted fixtures for endpoint** (with a *(fixture compiler flag off)* note if that flag is disabled).
- **Mapping readiness** — counts of fixtures with **manual overrides**, **endpoint scoped**, and **expected status set** (with a *(manual override flag off)* note when applicable).
- Any **hints** the platform surfaces for improving readiness.

Only **approved** requirements count here — see [Importing and reviewing requirements](/help-center/product-documentation/importing-and-reviewing-requirements).

## Step 5 — (Optional) override fixture mapping

The **Optional mapping overrides** card lists fixtures grouped **by sheet and column shape**; one mapping applies to every row in a group. Use **Refresh** to reload fixtures from every test-data file in the project. If there are none, you'll see *"No fixtures yet — Upload an Excel file on the Data for Generating Tests tab to populate this list."*

For each **Sheet: <name>** group, set:

| Control | What it does |
|---------|--------------|
| **Linked endpoints** | Scope the group to specific endpoints, or leave **All endpoints (auto-match by field overlap)**. |
| **Expected status** | The HTTP status these rows expect. The placeholder shows the auto-inferred value from the spec. |
| **Request mappings** | For each source field, choose where it maps: **query**, **path**, **header**, or **body**. |
| **Response assertions** | For each source field, choose the assertion: **fieldEquals**, **fieldExists**, **headerEquals**, **headerExists**, or **responseContains**. |

Every mapped field carries a source badge: **auto** (*"Auto-inferred from API spec / data — no override saved"*) or **override** (*"Override saved for this field"*). Expand **Show N data rows** to inspect the actual values. Click **Save mapping (N)** to persist the group's overrides; the button shows **Saving...** while it runs. **Auto-inference applies wherever no override is saved.**

## Notes

- Fixtures with no explicit endpoint link are auto-matched at compile time by field overlap, so you don't have to link every group manually.
- Re-extracting a file re-upserts its rows rather than duplicating them.
- The Generation Setup tab is a control surface, not a document list — switching to it doesn't re-fetch the upload table.

## Related articles

- [Importing and reviewing requirements](/help-center/product-documentation/importing-and-reviewing-requirements)
- [Coverage and fidelity](/help-center/product-documentation/coverage-and-fidelity)
- [Data-driven testing](/help-center/product-documentation/data-driven-testing)
- [Generate endpoint test cases](/help-center/product-documentation/ai-generated-tests)

