---
title: Configure local testing
meta:
  description: Set up fixtures and test suites for your Tinybird project.
---

# Configure local testing

Testing your data project locally ensures your resources work as expected before deploying to Tinybird Cloud.

You can validate and test with these workflows:

- Check the deployment before creating it.
- Create fixture files in your project.
- Ingest sample data through local APIs.
- Run and update YAML tests with `tb test`.

## Check deployment

After finishing development, run `tb deploy --check` to validate the deployment before creating it.

```shell
tb deploy --check
```

## Connection checks

When you run `tb deploy --check` (local) or `tb --cloud deploy --check` (cloud), Tinybird validates [external connections](/forward/get-data-in/connectors) to S3, Kafka, GCS, and databases referenced via [table functions](/forward/get-data-in/table-functions).

For local checks:

- Use [tb secret set](/forward/dev-reference/commands/tb-secret) to store connection secrets.
- If you use [S3 locally](/forward/get-data-in/connectors/s3#local-environment), start Tinybird Local with `tb local start --use-aws-creds`.

## Fixture files

Fixtures are sample files stored in the `fixtures/` folder.

```text
my-app/
├─ datasources/
│  ├─ user_actions.datasource
│  └─ ...
├─ fixtures/
│  ├─ user_actions.ndjson
│  └─ ...
```

Create fixtures manually. For example:

```shell
cat > fixtures/user_actions.ndjson <<'EOF'
{"timestamp":"2026-01-01 00:00:00","action":"CLICKED","user_id":"u_1"}
{"timestamp":"2026-01-01 00:01:00","action":"VIEWED","user_id":"u_2"}
EOF
```

When fixture files match the data source name (for example, `fixtures/user_actions.ndjson` for `datasources/user_actions.datasource`), `tb build` loads them automatically.

If you use custom fixture filenames, append them manually:

```shell
tb datasource append user_actions --file fixtures/custom_user_actions.ndjson
```

## Call the ingest APIs

You can also test by calling local ingest APIs:

- Send events to the local [Events API](/api-reference/events-api).
- Ingest files through the [Data sources API](/api-reference/datasource-api).

Get a token with `tb token ls`, then call your local endpoint:

{% tabs initial="cURL (Events API)" %}

{% tab label="cURL (Events API)" %}

```shell
curl \
      -X POST 'http://localhost:7181/v0/events?name=<your_datasource>' \
      -H "Authorization: Bearer <your_token>" \
      -d $'<your_data>'
```

{% /tab %}

{% tab label="Local file (Data sources API)" %}

```shell
curl \
-H "Authorization: Bearer <your-token>" \
-X POST "http://localhost:7181/v0/datasources?mode=append&name=<your_datasource>" \
-F csv=@local_file.csv
```
{% /tab %}

{% tab label="Remote file (Data sources API)" %}

```shell
curl \
-H "Authorization: Bearer <your-token>" \
-X POST "http://localhost:7181/v0/datasources?mode=append&name=<your_datasource>" \
-d url='<https://s3.amazonaws.com/remote_file.csv>'
```
{% /tab %}

{% /tabs %}

## Create a test suite

Create test YAML files manually in the `tests/` folder.

Example `tests/user_action_insights_widget.yaml`:

```yaml
- name: user_action_insights_widget_clicked
  description: Returns user actions filtered by CLICKED
  expected_http_status: 200
  parameters: action=CLICKED
  expected_result: |
    {"action":"CLICKED", "user_id":"u_1"}
```

Then run tests:

```shell
tb test run
```

To refresh expected results for a test file or resource:

```shell
tb test update user_action_insights_widget
```

Copy Pipes write into target data sources instead of returning rows directly. To test them:

1. Create a YAML test file for the copy pipe in `tests/`.
2. Run `tb copy run <copy_pipe>` to populate the target data source.
3. Run `tb test update <copy_pipe>` to capture expected results.

## Next steps

- Make changes to your data sources and test them. See [Evolve data sources](/forward/test-and-deploy/evolve-data-source).
- Learn more about [deployments](/forward/test-and-deploy/deployments).
- Learn about datafiles, like `.datasource` and `.pipe` files. See [Datafiles](/forward/dev-reference/datafiles).
