> ## 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

<ParamField path="id" type="string" required>
  UUID of the test case to retrieve.
</ParamField>

<ParamField query="fields" type="string">
  Comma-separated list of fields to include: `owners`, `testSuite`, `testDefinition`, `testCaseResult`.
</ParamField>

<ParamField query="include" type="string" default="non-deleted">
  Include `all`, `deleted`, or `non-deleted` entities.
</ParamField>

## Get by Fully Qualified Name

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

<ParamField path="fqn" type="string" required>
  Fully qualified name of the test case (e.g., `sample_data.ecommerce_db.shopify.dim_address.shop_id.column_value_max_to_be_between`).
</ParamField>

<ParamField query="fields" type="string">
  Comma-separated list of fields to include: `owners`, `testSuite`, `testDefinition`, `testCaseResult`.
</ParamField>

<ParamField query="include" type="string" default="non-deleted">
  Include `all`, `deleted`, or `non-deleted` entities.
</ParamField>

<RequestExample dropdown>
  ```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}: {tc.entityLink}")

  # 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}
  import static org.openmetadata.sdk.fluent.TestCases.*;

  // Get by ID
  var tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7");

  // Get by name with fields
  var tc = TestCases.retrieveByName(
      "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}"
  ```
</RequestExample>

<ResponseExample>
  ```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": []
  }
  ```
</ResponseExample>

***

## Returns

Returns a test case object with all requested fields populated.

## Response

<ResponseField name="id" type="string">
  Unique identifier for the test case (UUID format).
</ResponseField>

<ResponseField name="name" type="string">
  Test case name.
</ResponseField>

<ResponseField name="fullyQualifiedName" type="string">
  Fully qualified name of the test case.
</ResponseField>

<ResponseField name="entityLink" type="string">
  Entity link to the target table or column.
</ResponseField>

<ResponseField name="testDefinition" type="object">
  Reference to the test definition.
</ResponseField>

<ResponseField name="testSuite" type="object">
  Reference to the test suite.
</ResponseField>

<ResponseField name="parameterValues" type="array">
  Parameter values for this test case.
</ResponseField>

<ResponseField name="testCaseResult" type="object" optional>
  Most recent test result. Only included when `fields` contains `testCaseResult`.
</ResponseField>

<ResponseField name="version" type="number">
  Version number for the entity.
</ResponseField>

<ResponseField name="owners" type="array" optional>
  List of owners. Only included when `fields` contains `owners`.
</ResponseField>

***

## 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 |
