> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve a Test Case

> Get a test case by ID or fully qualified name

# Retrieve a Test Case

Get a single test case by its unique ID or fully qualified name.

## Get by ID

**id** `string` *required*

UUID of the test case to retrieve.

**fields** `string`

Comma-separated list of fields to include: `owners`, `testSuite`, `testDefinition`, `testCaseResult`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

## Get by Fully Qualified Name

Use `GET /v1/dataQuality/testCases/name/{fqn}` to retrieve by fully qualified name.

**fqn** `string` *required*

Fully qualified name of the test case, for example `sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between`.

**fields** `string`

Comma-separated list of fields to include: `owners`, `testSuite`, `testDefinition`, `testCaseResult`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

```python GET /v1/dataQuality/testCases/{id} theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import TestCases

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)

# Get by ID
tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
print(f"{tc.fullyQualifiedName.root}: {tc.entityLink.root}")

# Get by ID with fields
tc = TestCases.retrieve(
    "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
    fields=["owners", "testDefinition", "testCaseResult"]
)

# Get by fully qualified name
tc = TestCases.retrieve_by_name(
    "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between"
)

# Get by name with fields
tc = TestCases.retrieve_by_name(
    "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
    fields=["testCaseResult", "testDefinition"]
)
```

```java GET /v1/dataQuality/testCases/{id} theme={null}
// client is an initialized OpenMetadataClient.
var testCase = client.testCases().get("c1bce355-fa2f-48c6-ab4d-fad722a56ed7");

// Get by ID with fields
var testCaseWithFields = client.testCases().get(
    "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
    "testCaseResult,testDefinition");

// Get by fully qualified name
var testCaseByName = client.testCases().getByName("sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between");

// Get by name with fields
var testCaseByNameWithFields = client.testCases().getByName(
    "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
    "testCaseResult,testDefinition");
```

```bash GET /v1/dataQuality/testCases/{id} theme={null}
# Get by ID
curl "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
  -H "Authorization: Bearer {access_token}"

# Get by ID with fields
curl "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7?fields=testCaseResult,testDefinition" \
  -H "Authorization: Bearer {access_token}"

# Get by FQN
curl "{base_url}/api/v1/dataQuality/testCases/name/sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between" \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "id": "c1bce355-fa2f-48c6-ab4d-fad722a56ed7",
  "name": "column_value_max_to_be_between",
  "fullyQualifiedName": "sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between",
  "version": 0.1,
  "updatedAt": 1769982759035,
  "updatedBy": "admin",
  "testDefinition": {
    "id": "def-id",
    "type": "testDefinition",
    "name": "columnValueMaxToBeBetween",
    "fullyQualifiedName": "columnValueMaxToBeBetween",
    "deleted": false
  },
  "testSuite": {
    "id": "suite-id",
    "type": "testSuite",
    "name": "b5fcae09-02c2-4c0b-8c4a-5b52d650e592",
    "deleted": false
  },
  "entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address::columns::shop_id>",
  "parameterValues": [
    {"name": "minValueForMaxInCol", "value": "1"},
    {"name": "maxValueForMaxInCol", "value": "100"}
  ],
  "deleted": false,
  "owners": []
}
```

***

## Returns

Returns a test case object with all requested fields populated.

## Response

**id** `string`

Unique identifier for the test case (UUID format).

**name** `string`

Test case name.

**fullyQualifiedName** `string`

Fully qualified name of the test case.

**entityLink** `string`

Entity link to the target table or column.

**testDefinition** `object`

Reference to the test definition.

**testSuite** `object`

Reference to the test suite.

**parameterValues** `array`

Parameter values for this test case.

**testCaseResult** `object`

Most recent test result. Only included when `fields` contains `testCaseResult`.

**version** `number`

Version number for the entity.

**owners** `array`

List of owners. Only included when `fields` contains `owners`.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to view this test case |
| `404` | `NOT_FOUND` | Test case with given ID or FQN does not exist |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.