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

# Update a Test Case

> Update test case properties using JSON Patch

# Update a Test Case

Update a test case's properties using JSON Merge Patch. You can update by ID or by fully qualified name.

## Update by ID

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

## Update by Name

Use `PATCH /v1/dataQuality/testCases/name/{fqn}` to update by fully qualified name.

<ParamField path="fqn" type="string" required>
  Fully qualified name of the test case.
</ParamField>

## Body Parameters

Send a JSON object with the fields to update. Only provided fields are changed.

<ParamField body="description" type="string">
  Updated description in Markdown format.
</ParamField>

<ParamField body="parameterValues" type="array">
  Updated parameter values.

  <Expandable title="properties">
    <ParamField body="name" type="string" required>
      Name of the parameter.
    </ParamField>

    <ParamField body="value" type="string" required>
      Value for the parameter.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="owners" type="array">
  Updated list of owner references.

  <Expandable title="properties">
    <ParamField body="id" type="string">
      UUID of the owner entity.
    </ParamField>

    <ParamField body="type" type="string">
      Type of owner entity (e.g., `user`, `team`).
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample dropdown>
  ```python PATCH /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"
  )

  # Retrieve, modify, and update
  tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7")
  tc.description = "Updated: Validates shop_id max value stays between 1 and 200"
  tc.parameterValues = [
      {"name": "minValueForMaxInCol", "value": "1"},
      {"name": "maxValueForMaxInCol", "value": "200"}
  ]
  updated = TestCases.update(tc)

  print(f"Updated to version {updated.version}")
  ```

  ```java PATCH /v1/dataQuality/testCases/{id} theme={null}
  import static org.openmetadata.sdk.fluent.TestCases.*;

  var tc = TestCases.retrieve("c1bce355-fa2f-48c6-ab4d-fad722a56ed7");
  tc.setDescription("Updated: Validates shop_id max value stays between 1 and 200");
  var updated = TestCases.update(tc);
  ```

  ```bash PATCH /v1/dataQuality/testCases/{id} theme={null}
  # Update by ID
  curl -X PATCH "{base_url}/api/v1/dataQuality/testCases/c1bce355-fa2f-48c6-ab4d-fad722a56ed7" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json-patch+json" \
    -d '[
      {"op": "replace", "path": "/description", "value": "Updated: Validates shop_id max value stays between 1 and 200"},
      {"op": "replace", "path": "/parameterValues", "value": [{"name": "minValueForMaxInCol", "value": "1"}, {"name": "maxValueForMaxInCol", "value": "200"}]}
    ]'

  # Update by name
  curl -X PATCH "{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}" \
    -H "Content-Type: application/json-patch+json" \
    -d '[
      {"op": "replace", "path": "/description", "value": "Updated description"}
    ]'
  ```
</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",
    "description": "Updated: Validates shop_id max value stays between 1 and 200",
    "version": 0.2,
    "updatedAt": 1769982800000,
    "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": "200"}
    ],
    "deleted": false,
    "owners": []
  }
  ```
</ResponseExample>

***

## Returns

Returns the updated test case object with the new version number.

## 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="description" type="string">
  Updated description.
</ResponseField>

<ResponseField name="version" type="number">
  Incremented version number.
</ResponseField>

***

## Error Handling

| Code  | Error Type     | Description                                    |
| ----- | -------------- | ---------------------------------------------- |
| `400` | `BAD_REQUEST`  | Invalid JSON patch or malformed request        |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token        |
| `403` | `FORBIDDEN`    | User lacks permission to update this test case |
| `404` | `NOT_FOUND`    | Test case with given ID or FQN does not exist  |
| `409` | `CONFLICT`     | Concurrent modification detected               |
