# test

> Run schema and quality tests on configured servers.

# `datacontract test`

{/* AUTOGENERATED from `datacontract --help`: do not edit by hand; regenerate with update_command_docs.py */}

Run schema and quality tests on configured servers.

```bash
datacontract test [OPTIONS] [LOCATION]
```

| Argument | Default | Description |
|---|---|---|
| `[LOCATION]` | `datacontract.yaml` | The location (url, s3 url, or local path) of the data contract yaml. |

| Option | Default | Description |
|---|---|---|
| `--json-schema` | — | The location (url or path) of the ODCS JSON Schema |
| `--server` | `all` | The server configuration to run the schema and quality tests. Use the key of the server object in the data contract yaml file to refer to a server, e.g., `production`, or `all` for all servers (default). |
| `--schema-name` | `all` | Which schema to test, e.g., `orders`, or `all` for all schemas (default). |
| `--publish-test-results` / `--no-publish-test-results` | `--no-publish-test-results` | Deprecated. Use publish parameter. Publish the results after the test |
| `--publish` | — | The url to publish the results after the test. |
| `--output` | — | Specify the file path where the test results should be written to (e.g., './test-results/TEST-datacontract.xml'). |
| `--output-format` | — | The target format for the test results. Accepted values: json, junit. |
| `--checks` | — | Comma-separated list of check categories to run (available: schema, quality, servicelevel, custom). Omit to enable all. |
| `--dimension` | — | Comma-separated list of quality dimensions to run (available: accuracy, completeness, conformity, consistency, coverage, timeliness, uniqueness). Runs the quality rules declaring a matching `dimension`, plus the schema and service level checks that measure it. Omit to run everything. |
| `--quality-id` | — | Comma-separated list of quality rule ids to run, as defined in the `id` of the quality rule. Runs only those rules, no schema or service level checks. Fails if an id is not defined in the data contract. Omit to run everything. |
| `--tag` | — | Comma-separated list of tags to run. Runs the quality rules declaring a matching tag in their `tags`, no schema or service level checks. Omit to run everything. |
| `--filter` | — | A SQL predicate to filter the rows under test, in the dialect of the server, e.g., "ingested_at \>= CURRENT_DATE - 1". Only works if a single schema is tested; for contracts with multiple schemas, combine with --schema-name or use --filters. Schema checks and custom SQL queries are not filtered. |
| `--filters` | — | Row filters per schema, as a JSON object mapping schema name to SQL predicate, e.g., '\{"orders": "ingested_at \>= CURRENT_DATE - 1"\}'. Schema checks and custom SQL queries are not filtered. |
| `--include-failed-samples` / `--no-include-failed-samples` | `--no-include-failed-samples` | Collect a small sample of rows that failed each missing/invalid/duplicate check (identifier + offending columns; sensitive columns omitted). Off by default. |
| `--logs` / `--no-logs` | `--no-logs` | Print logs |
| `--ssl-verification` / `--no-ssl-verification` | `--ssl-verification` | SSL verification when publishing the data contract. |
| `--inline-references` / `--no-inline-references` | `--inline-references` | Resolve external references (currently: authoritativeDefinitions\[type in \{definition, semantics\}]) in the contract and inline the fetched content from the configured entropy-data host. |
| `--debug` / `--no-debug` | — | Enable debug logging |

```bash
datacontract test datacontract.yaml --server production
```

Guide: **[Test your Data](../testing/index.md)**.
