# Running tests with data

_NOTE: This is available only for select users. If you're interested in enabling this, please reach out to us at support@kusho.ai or your RM._

_This is a memory-intensive browser operation. If the page becomes slow or crashes while running a data file, try again with a smaller CSV, fewer parallel rows, or summary-only results._

Kusho lets you run the same API test or E2E workflow multiple times using rows from a CSV file. Each CSV row is treated as one run. The values in that row are available as variables during request resolution, pre-run scripts, post-run scripts, and assertions.

Use this when you want to validate the same API or workflow against multiple users, accounts, payload values, IDs, or edge-case inputs without creating a separate test case for each data set.

## CSV format

Upload a CSV file with a header row. Each header becomes a variable name, and each row below it becomes one run.

For example:

```csv
user_id,email,tier
101,alice@example.com,free
102,bob@example.com,pro
103,charlie@example.com,enterprise
```

In the request, scripts, and assertions, you can refer to these values using the same variable name:

```json
{
  "userId": "{{user_id}}",
  "email": "{{email}}",
  "tier": "{{tier}}"
}
```

## Running a single API with data

1. Open the test suite page.
2. Click **Run with Data**.
3. Upload a CSV file.
4. Review the detected rows and columns.
5. Click **Run**.

![Run with Data button on a single API test suite page](run-with-data-single-api-button.png)

![Single API Run with Data modal after uploading a CSV, showing detected rows/columns and the Run button](run-with-data-single-api-upload-modal.png)

Kusho runs the default test case once for each row in the CSV. For this mode of running, the default test case is the first test case of the test suite.

Open settings from the run modal to see the test case that will be used, along with its payload and assertions. The payload and assertions are collapsed by default; expand them when you want to inspect the exact method, URL, headers, path params, query params, request body, and assertions used for the run.

![Single API Run Data Settings modal showing the default test case, collapsed Payload section, and collapsed Assertions section](run-with-data-single-api-settings-modal.png)

## Running an E2E workflow with data

1. Open the E2E workflow.
2. Click **Run with Data**.
3. Upload a CSV file.
4. Review the detected rows and columns.
5. Configure settings if needed.
6. Click **Run**.

![Run with Data button on the E2E workflow page](run-with-data-e2e-button.png)

![E2E Run with Data modal after uploading a CSV, showing detected rows/columns and the Run button](run-with-data-e2e-upload-modal.png)

For E2E workflows, each CSV row drives one full workflow run. If your workflow has three APIs and your CSV has ten rows, Kusho runs the workflow ten times, once per row.

Kusho uses the default test case for each API in the workflow. For this mode of running, the default test case is the first test case of that test suite. Settings shows each API in workflow order, along with the payload and assertions that will be used.

![E2E Run Data Settings modal showing APIs in workflow order with Payload and Assertions sections collapsed](run-with-data-e2e-settings-modal.png)

You can also configure how many rows should run in parallel. A higher value can finish faster, but it also creates more browser and API load at the same time.

## Variable resolution

CSV row values are available as data variables during the run.

When resolving `{{​variable_name}}` placeholders, the row value is used ahead of the workspace or environment variable with the same name. This means a CSV column can override an existing variable for that run without changing the saved workspace variable.

For example, if your workspace has:

```text
email = default@example.com
```

and your CSV row has:

```csv
email
alice@example.com
```

then `{{​email}}` resolves to `alice@example.com` for that row.

Pre-run scripts can still update variables. If a pre-run script updates a variable, the script-updated value is used for request resolution after the script runs.

## Postman-style data access in scripts

In pre-run and post-run scripts, row data is available through `pm.iterationData` and `data`.

```javascript
const email = pm.iterationData.get("email");

pm.test("row email is present", function () {
  pm.expect(data.email).to.equal(email);
});
```

The current row number is available through `pm.info.iteration`, and the total row count is available through `pm.info.iterationCount`.

Data variables are run-level values. Kusho does not save CSV row values back to your workspace variables unless your script explicitly writes a value using supported variable APIs.

## Assertions

Kusho assertions run for each row.

The result for a row is based on the assertions that ran for that row. If any assertion fails, that row is marked as failed.

In E2E data runs, each API in the workflow has its own assertion result. The row is marked failed if any API in that workflow run has failing assertions or execution errors.

## Viewing run results

After a data run, Kusho shows one result row per CSV row.

![Data run results table showing row number, result/status, assertion counts, elapsed time, and pagination](run-with-data-results-table.png)

You can click the row number to view the data used for that run.

![Row Data modal showing the CSV values used for one run](run-with-data-row-data-modal.png)

You can click the status to view assertion details. For E2E runs, assertion details are grouped by API.

![Assertion Details modal showing failed/passed assertions grouped by API](run-with-data-assertion-details-modal.png)

In E2E runs, you can also click elapsed time to see timing details for each API in the workflow run.

![E2E timing details modal showing elapsed time per API](run-with-data-e2e-timing-modal.png)

The details view shows the request, response, assertions, and console output captured for that row. The response view focuses on the response body, headers, status code, error, and elapsed time.

If you enable summary-only results, Kusho stores only the lightweight result summary during the bulk run. Request, response, assertion detail, script console, and other large execution payloads are not retained for each row. To inspect a row in summary-only mode, click that row and run it again from the details view.

![Summary-only mode toggle in the Run with Data modal](run-with-data-summary-only-toggle.png)

![Summary-only detail empty state with the button to run that row again](run-with-data-summary-only-empty-state.png)

## Notes and limitations

Data runs currently support up to 600 CSV rows per run.

Large CSV files can create significant browser and API load. Start with a small file to validate the setup, then increase the row count once the run is working as expected. If the CSV has more than 50 rows, Kusho shows a warning because the run can make that many calls to your API. Be careful running large data files against production systems.

![Warning shown when the uploaded CSV has more than 50 rows](run-with-data-large-csv-warning.png)

If your API uses file upload bodies, configure the file upload settings separately. CSV data variables can drive text values, but attached files still use the file upload configuration for the test suite or test case.
