Last update: 2025-10-28T00:30:31.000Z
Content:
---
title: "Configure local testing · Tinybird Docs"
theme-color: "#171612"
description: "Set up fixtures and test suites for your Tinybird project."
inkeep:version: "forward"
---




# Configure local testing [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#configure-local-testing)

Copy as MD Testing your data project locally ensures that your resources are working as expected before you deploy your project to Tinybird.

There are several ways of generating test data for your local project. You can:

- Check the deployment before creating it. See[  Check deployment](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#check-deployment)  .
- Create fixtures and store them with your datafiles. See[  Fixture files](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#fixture-files)  .
- Generate mock data using the `tb mock`   command. See[  Generate mock data](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#generate-mock-data)  .
- Use Tinybird's ingest APIs to send events or files. See[  Call the ingest APIs](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#call-the-ingest-apis)  .
- Generate test suites using the `tb test`   command. See[  Create a test suite](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#create-a-test-suite)  .

## Check deployment [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#check-deployment)

After you finish developing your project, run `tb deploy --check` to validate the deployment before creating it. This is a good way of catching potential breaking changes. See [tb deploy](/docs/forward/dev-reference/commands/tb-deploy) for more information.

tb deploy --check
Running against Tinybird Local

» Validating deployment...

» Changes to be deployed...

-----------------------------------------------------------------
| status   | name         | path                                |
-----------------------------------------------------------------
| modified | user_actions | datasources/user_actions.datasource |
-----------------------------------------------------------------

✓ Deployment is valid
## Connection checks [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#connection-checks)

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

To make these checks succeed locally, you’ll need to make sure the right credentials are available:

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

## Fixture files [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#fixture-files)

Fixtures are NDJSON files that contain sample data for your project. Fixtures are stored inside the `fixtures` folder in your project.

my-app/
├─ datasources/
│  ├─ user_actions.datasource
│  └─ ...
├─ fixtures/
│  ├─ user_actions.ndjson
│  └─ ... Every time you run `tb build` , the CLI checks for fixture files and includes them in the build. Fixture files must have the same name as the associated .datasource file.

## Generate mock data [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#generate-mock-data)

The `tb mock` command creates fixture files based on your data sources. See [tb mock](/docs/forward/dev-reference/commands/tb-mock) for more information.

By default, fixture files share the same name as their corresponding `.datasource` file. When you run `tb build` , the data from these fixtures is automatically appended to the Data Source in your local development environment. You can view this data in the local Tinybird UI ( `tb dev --ui` ).

If you rename a fixture file or create additional fixtures for a single Data Source, you must load the data manually using the<a href="/docs/forward/dev-reference/commands/tb-datasource"> `tb datasource append` command</a> . For example:

tb datasource append your_data_source --file fixtures/custom_fixture_name.ndjson For example, the following command creates a fixture for the `user_actions` data source.

tb mock user_actions

» Creating fixture for user_actions...
✓ /fixtures/user_actions.ndjson created
... You can use the `--prompt` flag to add more context to the data that is generated. For example:

tb mock user_actions --prompt "Create mock data for 23 users from the US"`
## Call the ingest APIs [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#call-the-ingest-apis)

Another way of testing your project is to call the local ingest APIs:

- Send events to the local[  Events API](/docs/api-reference/events-api)   using a generator.
- Ingest data from files using the[  Data sources API](/docs/api-reference/datasource-api)  .

Obtain a token using `tb token ls` and call the local endpoint:

- cURL (Events API)
- Local file (Data sources API)
- Remote file (Data sources API)

curl \
      -X POST 'http://localhost:7181/v0/events?name=<your_datasource>' \
      -H "Authorization: Bearer <your_token>" \
      -d $'<your_data>' As you call the APIs, you can see errors and warnings in the console. Use this information to debug your datafiles.

## Create a test suite [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#create-a-test-suite)

Once your project builds correctly, you can generate a test suite using [tb test](/docs/forward/dev-reference/commands/tb-test).

For example, the following command creates a test suite for the `user_action_insights_widget` pipe.

# Pass a pipe name to create a test
tb test create user_action_insights_widget Then, customize the tests to fit your needs.

You can use the `--prompt` flag to add more context to the data that is generated. For example:

tb test create user_action_insights_widget --prompt "return user actions filtering by CLICKED" The output of the command is a test suite file that you can find in the `tests` folder of your project.

- name: user_action_insights_widget_clicked
  description: Test the endpoint that returns user actions filtering by CLICKED
  parameters: action=CLICKED
  expected_result: |
    {"action":"CLICKED", "user_id":1, "timestamp":"2025-03-19T01:58:31Z"}
    {"action":"CLICKED", "user_id":2, "timestamp":"2025-03-20T05:34:22Z"}
    {"action":"CLICKED", "user_id":3, "timestamp":"2025-03-21T19:21:34Z"} When creating tests, follow these guidelines:

- Give each test a meaningful name and description that explains its purpose.
- Define query parameters without quotes.
- The `expected_result`   should match the data object from your endpoint's response.
- An empty string ( `''`   ) in the `expected_result`   means the endpoint returns no data. If an empty result is unexpected, verify your endpoint's output and update the test by running:

tb test update user_action_insights_widget Copy Pipes behave differently from other Pipes because they don't output queryable results. Instead, they write to a target Data Source. To test Copy Pipes:

1. Create a test for the copy pipe:

tb test create <copy_pipe>
1. Run the copy pipe to populate the target data source:

tb copy run <copy_pipe>
1. Update the test to capture the target data source data:

tb test update <copy_pipe> This populates the `expected_result` in the test with the contents of the target Data Source.

Once you have your test suite, you can run it using the `tb test run` command.

tb test run

» Running tests

* user_action_insights_widget_clicked.yaml
✓ user_action_insights_widget_clicked passed

✓ 1/1 passed
## Next steps [¶](https://www.tinybird.co/docs/forward/test-and-deploy/test-your-project#next-steps)

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


