Testing
Run the checks that match the area you changed. Do not open a pull request without testing the part of the product you touched.
What To Record In The PR
Your pull request should say:
- what you verified locally
- what tests you added or updated
- what still needs QA
Loading Environment Variables
The API, SDK, and services tests run against a live stack, so start Agenta locally first (see Development Mode). The test commands need the same environment variables the stack was started with, in particular AGENTA_API_URL and AGENTA_AUTH_KEY.
Add this helper to your ~/.bashrc or ~/.zshrc:
load-env() {
local env_file="${1:-.env}"
if [[ ! -f "$env_file" ]]; then
echo "Error: File '$env_file' not found."
return 1
fi
set -o allexport && source "$env_file" && set +o allexport
}
Then source the env file you deployed with before running tests:
load-env hosting/docker-compose/oss/.env.oss.dev
To load the file without a shell helper, pass --env-file to the Python test runner. First unset any exported AGENTA_API_URL and AGENTA_AUTH_KEY: the runners read these variables before loading the file, so existing values take precedence. For example, from api/, after installing dependencies:
unset AGENTA_API_URL AGENTA_AUTH_KEY
uv run --no-sync python run-tests.py --env-file ../hosting/docker-compose/oss/.env.oss.dev
The SDK and services runners accept the same option. Paths are relative to the directory you run the command from: use ../../hosting/docker-compose/oss/.env.oss.dev from sdks/python/, or ../hosting/docker-compose/oss/.env.oss.dev from services/. Choose the file that matches your running stack.
This preserves quoted values containing spaces. Avoid loading .env files through export $(... | xargs), which splits those values into separate shell arguments.
API Tests
Install dependencies first (from api/):
uv sync --locked
This also installs the local Python SDK from sdks/python in editable mode. You do not need to install it separately.
Then run the suite through the test runner:
uv run --no-sync python run-tests.py
Or point the runner at a smaller target:
uv run --no-sync python run-tests.py oss/tests/pytest/acceptance/workflows/
The runner wraps pytest. It runs the tests in both the oss and ee test trees and passes any extra flags straight to pytest.
SDK Tests
Install dependencies first (from sdks/python/):
uv sync --locked
Then run the suite, or only the unit tests:
uv run --no-sync python run-tests.py
uv run --no-sync python run-tests.py oss/tests/pytest/unit/
Services Tests
Install dependencies first (from services/):
uv sync --locked
Then run the suite:
uv run --no-sync python run-tests.py
Web Tests
Install dependencies first (from web/):
pnpm install
Then from web/tests/, run the full acceptance suite:
pnpm test:acceptance
Or the smoke suite for a smaller target:
pnpm test:smoke
Web tests may need Testmail credentials. Check web/tests/README.md if you need the full setup.
More Detail
For the full testing reference, read docs/design/testing/README.md. That document covers the full test layout, filters, and runner details across the monorepo.