# From project root
just b test # Run all tests
just b test -n=auto # Run tests in parallel
just b test tests/path/ # Run specific tests
# With ramdisk database (2-5x faster)
just test-db start # Start PostgreSQL with tmpfs
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
Test settings (baserow/config/settings/test.py) are designed for consistency and portability:
This allows tests to run identically inside Docker and locally.
All backend justfile commands (just test, just lint, etc.) work identically inside and outside Docker containers. The test settings are designed to be portable.
| Command | Host | Container | Notes |
|---|---|---|---|
just b test |
✓ | ✓ | Works in both environments |
just b lint |
✓ | ✓ | Works in both environments |
just test-db start |
✓ | ✗ | Host only (starts a Docker container) |
just test-db stop |
✓ | ✗ | Host only |
Note: The just test-db start command starts a separate PostgreSQL container with tmpfs storage. This can only be run from the host machine, not from inside a container. When running tests inside the backend container, use the existing db service instead.
Pass database connection via environment variable:
# Using DATABASE_URL
DATABASE_URL=postgres://baserow:baserow@localhost:5432/baserow just b test
# Or individual variables
DATABASE_HOST=localhost DATABASE_PORT=5432 just b test
Inside the container, the default settings work out of the box:
just dcd up -d db backend
just dcd exec backend bash
j test
# Or directly
just dcd up -d db backend && just dcd exec backend "just test -n auto"
For complex configurations, use a file:
# Create .env.testing-local (gitignored)
cat > .env.testing-local << 'EOF'
DATABASE_HOST=localhost
DATABASE_PORT=5432
REDIS_HOST=localhost
# Any other env var customization here
EOF
# Run tests with file
TEST_ENV_FILE=.env.testing-local just b test
Use a PostgreSQL container with tmpfs (in-memory storage) for 2-5x faster tests:
# Start ramdisk database on port 5433
just test-db up
# Run tests against it
DATABASE_URL=postgres://baserow:baserow@localhost:5433/baserow just b test -n=auto
# Stop when done
just test-db down
# Check status
just test-db ps
Configuration: Set TEST_DB_PORT environment variable to use a different port (default: 5433).
The ramdisk database (baserow-test-db container using pgvector/pgvector:pg14) runs with optimized settings:
By default, BASEROW_TESTS_SETUP_DB_FIXTURE=on skips migrations and only installs required pgSQL functions. This speeds up test setup significantly.
# Run with full migrations (slower, useful for testing migrations)
BASEROW_TESTS_SETUP_DB_FIXTURE=off just b test
# Reuse database between test runs (fastest for iterative development)
just b test --reuse-db
# Apply new migrations to existing test database
BASEROW_TESTS_SETUP_DB_FIXTURE=off just b test --no-migrations --reuse-db
| Command | Description |
|---|---|
just b test |
Run all tests |
just b test -n=auto |
Run tests in parallel |
just b test tests/path/ |
Run specific tests |
just b test-coverage |
Run tests with coverage report |
just b test-builder |
Run builder-specific tests |
just b test-automation |
Run automation-specific tests |