tb test¶
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¶
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.
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¶
Updates the test's expectations. For example: tb test update get_lego_sets_by_year
.