/bigtesty:python-testsfrom BigTesty
Sets up ephemeral BigQuery infrastructure for integration tests in Python (pytest/unittest), Java (JUnit 5, Testcontainers), or Go. Use when tests need real BigQuery datasets created in setup and deleted in teardown.
Ships in BigTesty. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
To test SQL alone, prefer test files (writing-tests skill): no code, datasets isolated per scenario. Use
BigTestyInfra when the code under test is Python (or a tool such as dbt) that reads or writes BigQuery.
bigtesty.yaml declares the datasets and tables, as for the test files; it doesn't need test files. One infra is
created per lifecycle (a pytest fixture scope, a unittest class) and shared by its tests.
from bigtesty.testing import BigTestyInfra
with BigTestyInfra.from_config("tests/bigtesty.yaml") as infra: # start() / stop(passed) without `with`
infra.load("monitoring.job_failure", [{"featureName": "featurePSG", "jobName": "job1"}]) # or a JSON/YAML file
build_failures_summary(infra.client, infra.dataset_id("monitoring")) # the code under test
rows = infra.query("SELECT * FROM monitoring.job_failure_summary") # rewritten to the infra, list of dicts
| Member | Use |
|---|---|
dataset_id("monitoring") / table_id("monitoring.t") | the IDs to give to the code under test |
sql(sql) | rewrite production SQL with hardcoded datasets, e.g. passed to the code under test |
query(sql, parameters=None) | run a query or script, the configured datasets are rewritten; parameters are BigQuery query parameters ({"since": {"type": "DATE", "value": "2026-01-01"}}) |
truncate(*tables) / reset() | empty some / all the tables (free), the DDL objects are kept |
client, run_id, bytes_billed | the BigQuery client, the run ID, the bytes billed by query |
from_config takes project, location, cleanup and client overrides; the project otherwise comes from
BIGTESTY_PROJECT / GOOGLE_CLOUD_PROJECT, then the config.
The production code must take the dataset (or table) ID as a parameter, or the SQL rewrite function: never a hardcoded production dataset. That is the only change the tests need.
@pytest.fixture(scope="module") # the lifecycle of the infra: class, module, session...
def infra():
with BigTestyInfra.from_config(Path(__file__).parent / "bigtesty.yaml") as infra:
yield infra
@pytest.mark.parametrize(("failures", "expected"), [...]) # the scenarios
def test_failures_summary(infra, failures, expected):
# GIVEN
infra.reset() # the tests sharing an infra share its data
infra.load("monitoring.job_failure", failures)
# WHEN
build_failures_summary(infra.client, infra.dataset_id("monitoring"))
# THEN
assert infra.query("SELECT featureName, failuresCount FROM monitoring.job_failure_summary ORDER BY 1") == expected
Always reset() (or truncate) at the start of a test, or load the data once in the fixture: unlike the test
files, the data of a test is seen by the next ones. The plugin also provides a session-scoped bigtesty_infra
fixture, configured with --bigtesty-config, --bigtesty-project...
unittest: start() in setUpClass, stop() in tearDownClass, reset() in setUp.
dbt and other tools: declare the datasets they read and write in bigtesty.yaml and pass their IDs (env vars of
the profile, --vars), then check the result with infra.query.
The CLI is the contract; the tests load and query with the BigQuery client of their language:
bigtesty infra create --output json # stdout: {"run_id", "project", "datasets", "tables", ...}
bigtesty infra destroy --run-id <run_id>
Call create in the setup (@BeforeAll in JUnit 5) and destroy in the teardown (@AfterAll). Without Python,
use the image groupbees/bigtesty (with docker run or a one-shot Testcontainers container), mounting the project
on /usr/local/src/app/project and the gcloud config on /usr/local/src/app/.config/gcloud. Full Java example:
https://tosun-si.github.io/bigtesty/running-tests/other-languages/.
A killed test run leaves the infra: its tables expire after table_expiration_hours and bigtesty gc deletes the
datasets.
To list and run the scenarios of the test files from a program (a web app, a scheduler), use bigtesty.api, not a
subprocess parsing the text report:
from bigtesty.api import Project
project = Project.load("bigtesty.yaml", project="my-project") # validated once, no BigQuery call
ids = [scenario.id for scenario in project.scenarios]
report = project.run(ids[:1]) # exact IDs, or run() for all: a new run with its own datasets
report.to_dict() # the JSON report: status, structured diffs, failed step
What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/setupSet BigTesty up in a project to test BigQuery SQL on real BigQuery - install it with uv, authenticate on GCP, write the bigtesty.yaml config (datasets, tables, DDL, labels, CMEK, cleanup, max_bytes_billed) and run the tests in CI (GitHub Actions, GitLab CI, Cloud Build). Use when adding BigTesty to a project, writing or reviewing a bigtesty.yaml, wiring the tests in a pipeline, or upgrading from BigTesty 0.x./troubleshootingFind why a BigTesty run fails and fix it - a failed assertion diff, an invalid config or test file (exit code 2), a GCP authentication or permission error, a location or CMEK error, a query over max_bytes_billed, a SQL reference that was not rewritten, or datasets left in BigQuery. Use when bigtesty test, pytest with BigTesty, BigTestyInfra or bigtesty infra create fails or behaves unexpectedly./writing-testsWrite BigTesty test files (*.bigtesty.yaml) that test BigQuery SQL - a query, a script, a MERGE, a procedure - with given rows, a when step and then assertions (expected rows, row_count, Python functions). Use when testing BigQuery SQL with BigTesty, adding a scenario, choosing between inline expected rows and expected files, generating them with --update, or reviewing a test file.npx claudepluginhub tosun-si/bigtesty --plugin bigtestyOther plugins' skills for the same job