

BigTesty is an integration testing framework for BigQuery, running the tests on a real and short-lived
infrastructure.
Documentation: tosun-si.github.io/bigtesty
The story of BigTesty 1.x, and how it tests the production SQL as is:
Don't mock BigQuery, test on BigQuery.
- The real BigQuery engine, no emulator: the SQL behaves exactly as in production.
- Given / When / Then test files in YAML or JSON: load test data, run any SQL (queries, DML,
MERGE,
scripts, procedures), then assert on query results or table contents.
- Isolated and ephemeral: each scenario of each run gets its own datasets, created and destroyed by BigTesty.
Several developers and CI pipelines can run the tests at the same time.
- Production SQL unchanged: the references to your datasets are rewritten to the isolated datasets.

Installation
Python 3.11+ is required.
# as a dev dependency of a uv project, the version is locked in uv.lock
uv add --dev bigtesty
# or as a standalone CLI
uv tool install bigtesty
# or with pip, in a virtual environment
pip install bigtesty
BigTesty uses Application Default Credentials:
gcloud auth application-default login
Quick start
A BigTesty project is a bigtesty.yaml config file declaring the datasets and tables, and test files named
*.bigtesty.yaml (or .yml / .json):
bigtesty.yaml
schema/monitoring/job_failure.json
ddl/monitoring/v_failures_count_by_feature.sql
tests/monitoring/
├── find_failures.bigtesty.yaml
├── merge_failures_summary.bigtesty.yaml
├── assertion_functions/failures_assertions.py
├── given/input_failures_feature_name.json
├── queries/find_failures_by_feature_name.sql
├── then/expected_failures_feature_name.json
└── when/merge_failures_summary.sql
bigtesty.yaml: the datasets and tables created for each scenario.
project: my-project # or --project / GOOGLE_CLOUD_PROJECT
location: EU
tests: tests
datasets:
- id: monitoring
tables:
- id: job_failure
schema_file: schema/monitoring/job_failure.json # BigQuery JSON schema
partitioning: { type: DAY, field: dwhCreationDate }
clustering: [featureName, jobName]
- id: job_failure_summary
schema: # or inline
- { name: featureName, type: STRING }
- { name: failuresCount, type: INT64 }
- { name: lastFailureDate, type: TIMESTAMP }
ddl_files: # views, functions, procedures...
- ddl/monitoring/*.sql
tests/monitoring/merge_failures_summary.bigtesty.yaml: one or several scenarios.