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

# List Test Cases

> List all test cases with optional filtering and pagination

# List Test Cases

List all test cases with optional filtering and pagination.

## Query Parameters

**limit** `integer` (default: 10)

Maximum number of results to return (max: 1000000).

**before** `string`

Cursor for backward pagination.

**after** `string`

Cursor for forward pagination.

**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.

**testSuiteId** `string`

Filter by test suite UUID.

**entityLink** `string`

Filter by entity link (URL-encoded). Returns test cases for a specific table or column.

**includeAllTests** `boolean` (default: false)

Include test cases from all test suites, not just the primary executable suite.

**orderByLastExecutionDate** `boolean` (default: false)

Order results by the most recent test execution date.

## Filter by Multiple Statuses

To filter by status, use the search endpoint `GET /v1/dataQuality/testCases/search/list` with the `testCaseStatus` parameter. Pass several statuses by repeating the parameter or separating values with commas. A test case matches if it has any of the statuses.

**testCaseStatus** `string`

One or more of `Success`, `Failed`, `Aborted`, `Queued`. Values are not case sensitive. An unknown value returns a `400` error that lists the allowed values. Other filters, such as `entityLink` and `testCaseType`, still apply together with this one.

```text theme={null}
GET /v1/dataQuality/testCases/search/list?testCaseStatus=Failed&testCaseStatus=Aborted
GET /v1/dataQuality/testCases/search/list?testCaseStatus=Failed,Aborted
```

> [!NOTE]
>
> This endpoint (`GET /v1/dataQuality/testCases`) accepts only one status.

```python GET /v1/dataQuality/testCases 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"
)

# List first page
cases = TestCases.list(fields=["testDefinition", "testSuite"], limit=50)
for tc in cases.entities:
    print(f"{tc.fullyQualifiedName.root}")

# List all with auto-pagination
for tc in TestCases.list_all(fields=["testDefinition", "testSuite"]):
    print(f"{tc.name.root}: {tc.entityLink.root}")

# Filter by test suite
cases = TestCases.list(
    filters={"testSuiteId": "e86a9a11-852f-4bac-b5a7-993b2bbbb572"},
    fields=["owners", "testDefinition", "testSuite", "testCaseResult"],
    limit=50
)

for tc in cases.entities:
    print(f"{tc.name.root} - {tc.testDefinition.name}")

# Filter by entity link
cases = TestCases.list(
    filters={"entityLink": "<#E::table::sample_data.ecommerce_db.shopify.dim_address>"},
    fields=["testDefinition", "testSuite", "testCaseResult"],
    limit=50
)
```

```java GET /v1/dataQuality/testCases theme={null}
import org.openmetadata.sdk.models.ListParams;

// client is an initialized OpenMetadataClient.
// List first page
var params = new ListParams().setLimit(50);
var page = client.testCases().list(params);
for (var item : page.getData()) {
    System.out.println(item.getFullyQualifiedName());
}

// Filter by test suite with fields
var filtered = new ListParams()
    .addFilter("testSuiteId", "e86a9a11-852f-4bac-b5a7-993b2bbbb572")
    .setFields("testCaseResult,testDefinition")
    .setLimit(50);
var filteredPage = client.testCases().list(filtered);
for (var item : filteredPage.getData()) {
    System.out.println(item.getFullyQualifiedName());
}
```

```bash GET /v1/dataQuality/testCases theme={null}
# List all
curl "{base_url}/api/v1/dataQuality/testCases?limit=50" \
  -H "Authorization: Bearer {access_token}"

# Filter by test suite
curl "{base_url}/api/v1/dataQuality/testCases?testSuiteId=e86a9a11-852f-4bac-b5a7-993b2bbbb572&limit=50" \
  -H "Authorization: Bearer {access_token}"

# Filter by entity link
curl "{base_url}/api/v1/dataQuality/testCases?entityLink=%3C%23E%3A%3Atable%3A%3Asample_data.ecommerce_db.shopify.dim_address%3E&limit=50" \
  -H "Authorization: Bearer {access_token}"

# With fields and ordering
curl "{base_url}/api/v1/dataQuality/testCases?fields=testCaseResult,testDefinition&orderByLastExecutionDate=true&limit=50" \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "data": [
    {
      "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": []
    }
  ],
  "paging": {
    "after": "...",
    "total": 8
  }
}
```

***

## Returns

Returns a paginated list of test case objects. Use the `fields` parameter to request additional data.

## Response

**data** `array`

Array of test case objects.

**properties**

**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. Only included when `fields` contains `testDefinition`.

**testSuite** `object`

Reference to the test suite. Only included when `fields` contains `testSuite`.

**parameterValues** `array`

Parameter values for this test case.

**testCaseResult** `object`

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

**owners** `array`

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

**paging** `object`

Pagination information.

**properties**

**total** `integer`

Total count of test cases matching the query.

**after** `string`

Cursor for the next page of results.

**before** `string`

Cursor for the previous page of results.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to list test cases |


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