Testing
Prepare the required dependencies using development setup. Default tests use synthetic data and model substitutes. Tests marked live require explicit selection and credentials.
| Task | Command |
|---|---|
| Run one Python test file | uv run --no-sync pytest -q tests/test_api.py |
| Check Python code | uv run --no-sync ruff check . and uv run --no-sync ruff format --check . |
| Run unit tests | make ut; select components with SCOPE=dataagent,api |
| Run serial system tests | make st, which builds TUI first |
| Run both test tiers | make test, covering Python, API, Web, TUI, deployment, and YAML |
| Verify documentation build and links | npm run docs:build and npm run smoke:docs |
Make test entry points synchronize dependencies once when Python is needed. With an existing environment, pass UV_RUN_OPTS=--no-sync. Inspect the actual commands for each tier with the test runner --list option:
uv run --no-project python scripts/run_product_tests.py --tier test --scope dataagent --listPass Python filters through PYTEST_ARGS and Node test arguments through NODE_TEST_ARGS. System tests run serially. make st rejects pytest -n and --numprocesses; make test passes them to unit tests and removes them from system-test arguments. Summaries and JUnit results are stored in artifacts/product/.
Direct pytest execution excludes tui and live markers by default. Tests marked tui that need a real terminal also require a built TUI and a POSIX pseudoterminal.
Test coverage
| Area | Test files |
|---|---|
| Configuration merging, YAML, and Home startup | test_config.py, test_config_documents.py, test_home_startup.py |
| Declarations and compilation | test_declarations.py, test_compiler.py, test_compiler_contract.py |
| Host prompt rendering and wheel-installed resources | test_prompts.py, packaging/test_installed.py |
| Hooks | test_hooks.py, test_native_hooks.py |
| MCP | test_mcp.py |
| Semantic configuration and client | test_semantic_configuration.py, test_semantic_client.py |
| Sessions, outputs, and traces | test_session_isolation.py, test_outputs.py, test_traces.py |
| Extension refresh | test_agent_refresh.py |
| HTTP | test_api.py, test_product_api.py |
| A2A contracts, diagnostics, and cancellation | test_a2a_server.py, test_a2a_client.py, test_a2a_observability.py |
| A2A real-process startup and restart | test_a2a_e2e.py; a local synthetic provider, with no real-model requests |
| A2A real-model behavior | test_a2a_live.py; run with explicitly supplied gateway variables |
| nl2sql delegation, result files, and limits | test_nl2sql_plugin.py; scripted parent/child models and local SQLite |
| nl2sql SQL safety and scenario packs | test_nl2sql_security_rules.py, test_nl2sql_scenario_assembly.py, nl2sql_scenarios/ |
| Backend logs, rotation, and redaction | test_logging.py |
| Example assembly | test_examples.py |
Non-live cases in test_product_e2e.py use a scripted provider and cover TUI, backend, tools, Skills, subagents, Checkpoints, and restart. Only live cases call real providers.
test_a2a_e2e.py belongs to the product runner's serial system tests. It verifies real serve-a2a processes, TCP, anonymous access by default, model-error classification, persisted logs, and conversation history continuing after restart even though old Tasks no longer exist. External HTTPS and gateway integration still need verification in the actual deployment environment.
Verify the A2A protocol
Run controlled-model tests from the repository root without accessing a real model or semantic service:
uv run --no-sync pytest -q tests/test_a2a_server.py tests/test_a2a_client.py tests/test_a2a_observability.py tests/test_a2a_hitl.py- Server and client tests cover Agent Cards, Bearer tokens, session ownership, and outbound conversation continuity.
- Diagnostic tests cover nonblocking task queries/cancellation and correlation between request IDs, task IDs, and traces.
- HITL tests cover both service entry points, synchronous and nonblocking calls, recovery and repeated interrupts, native tool approval, and cancellation.
For manual integration, enable data-qa in a usable model configuration and ask the main Agent to call data-qa__request_human_feedback. Use the actual Task, session, and pause IDs to answer according to the A2A HITL contract. Automated tests assemble native interrupt_on to verify tool approval.
Joint A2A and nl2sql verification
Passing the protocol and plugin tests independently does not establish that real-model delegation works end to end. Joint verification should cover parent routing, nl2sql business results, sessions/outputs, and error correlation. Test design determines the data, cases, and execution plan; this page owns the automated entry points and the coverage boundaries.
Keep the main Agent entry, and check the actual task delegation, business results, CSV/meta, and diagnostic correlation. The difference between TASK_STATE_COMPLETED and a successful query is described in A2A and local subagents. Record local-schema and real-semantic-service coverage separately; controlled-model tests do not replace joint testing in the real environment.
Packaging tests
uv run --no-sync pytest -q tests/packagingPackaging tests build an sdist in a temporary directory, then verify that a wheel built from the sdist installs independently, including CLI, SDK, and built-in resources. See release verification for end-to-end checks of the current deliverables.
Real models
The A2A path uses three variables: DATAAGENT_A2A_LIVE_BASE_URL (a model gateway URL including /v1), DATAAGENT_A2A_LIVE_API_KEY, and DATAAGENT_A2A_LIVE_MODEL. Inject credentials through the current process environment, then run from the repository root:
uv run --no-sync pytest tests/test_a2a_live.py -m live -qA case skips when any variable is absent. Each one starts a local anonymous serve-a2a and covers:
- Automatic context creation and continued memory.
- Same-context queuing and Checkpoint inheritance; concurrency across different contexts.
- Anonymous queries and cancellation, plus continuation after a cancellation.
- IDs and error codes correlated across responses, session indexes, traces, and logs.
Callers share the same team scope; no identity or storage entity is added.
A local relay passes through real-model responses and controls reading after the request has reached the real gateway, making queuing, cancellation, and TIMEOUT reproducible. Error cases also send one invalid model key to the real gateway, verifying that upstream 401 becomes task MODEL_ERROR; this is unrelated to authentication at the A2A entry. Cancellation verifies local task termination and session release, not whether upstream computation or billing stops.
The temporary Home's model configuration stores only $env{DATAAGENT_A2A_LIVE_API_KEY} references. Each case creates a2a-live-report.json, backend.stderr.log, and existing Home logs, Checkpoints, and traces under pytest's temporary directory, then checks that artifacts contain no real key. Reports retain IDs and diagnostic paths for inspection. Except for the upstream-authentication case that requires 401, requests to the real gateway must eventually return 200, including cancellation and timeout cases, so delays do not hide invalid credentials.
Cases require an error root span, a model child span, error details, correlated IDs, and Checkpoints; report modelSpanPresent must be true. Interrupted model records retain native IDs, parents, and start times, with interrupted locally in the error. Model results and token usage reflect actual responses. Active cancellation and timeout can both produce root CancelledError; distinguish them through task metadata.dataagent.error.code (CANCELLED / TIMEOUT) and logs. See execution traces for export rules.
Product path:
DATAAGENT_LIVE_ENV=/absolute/path/to/.env \
uv run pytest tests/test_product_e2e.py -m live -qThe semantic client has a separate, skipped-by-default path:
DATAAGENT_SEMANTIC_LIVE_ENV=/absolute/path/to/.env \
uv run pytest tests/test_semantic_live.py -m live -qOnly when DATAAGENT_SEMANTIC_LIVE_URL is also set do fixtures call read-only endpoints of a deployed semantic service. Otherwise they use local HTTP and verify only client transport and injection.
Supply credentials through the current process environment or an external .env file. Do not put keys in test assertions or temporary configuration.
TUI
After development setup, use npm run test:tui to compile and run Node tests. For backend integration, run make st, which also builds TUI. Python tui tests require POSIX PTY. Verify input-method candidate windows manually in the real terminal.
Before changing Ink fullscreen cursor handling, run the Python suite's PTY probe. If upstream has fixed the one-line offset, remove the patch rather than adding a second layer.