Last update: 2025-12-18T09:52:50.000Z
Content:
---
title: "tb test · Tinybird Docs"
theme-color: "#171612"
description: "Generate and run tests for your Tinybird project"
inkeep:version: "forward"
---




# tb test [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-test#tb-test)

Copy as MD Generates and runs tests.

The following subcommands are available:

| Command | Description |
| --- | --- |
| create [OPTIONS] | Creates a test in YAML format from a pipe datafile. |
| run [FILES] | Runs all the tests in the project or specific tests passed as arguments. |
| update [FILES] | Updates the test's expectations. |

## tb test create [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-test#tb-test-create)

Creates a test in YAML format from an API endpoint.

For example: `tb test create api_events --prompt "test for the customer id 42 and the event type 'purchase'"`.

| Option | Description |
| --- | --- |
| --prompt TEXT | Passes a prompt to generate a customized test. |

Tests are stored in the `tests` folder in your project as YAML files. For a description of the test file format, see [Test files](/docs/forward/dev-reference/datafiles/test-files).

## tb test run [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-test#tb-test-run)

Runs all the tests in the project `tb test run` or specific tests passed as arguments. Tests are run with fixture data against your local.

For example: `tb test run tests/get_lego_sets_by_year.yaml` will return:

Running against Tinybird Local

» Building test environment
✓ Done!

» Running tests
* get_sets_by_theme_year.yaml
✓ get_sets_by_theme_year_2000s_range passed
✓ get_sets_by_theme_year_1990s_range passed Tinybird creates a fresh workspace for each test run. Secrets will not persist between test runs. To avoid test failures, add a default value to your secrets: `{{ tb_secret("secret_name", "default_value") }}`.

## tb test update [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-test#tb-test-update)

Updates the test's expectations. For example: `tb test update get_lego_sets_by_year`.

## Environment support [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-test#environment-support)

| Environment | Supported | Description |
| --- | --- | --- |
| `--local` | ✓ Yes (default) | Runs tests locally with fixture data. |
| `--cloud` | ✗ No | Tests run locally, not in cloud. |
| `--branch=BRANCH_NAME` | ✗ No | Tests run locally, not in branches. |


