# Update execution case

URL: https://docs.ones.cn/developer/abilities/events/test-management/execution-case/execution-case-updated

This event is emitted after one or more writable fields of an execution case actually change. Submitting unchanged values does not emit an event. An overall execution result change derived from step results is included in the same event.

## Event Body

### Execution Case Event Schema

Execution case lifecycle event structure

#### Properties

eventID * string
Unique identifier for the event

eventType * string
Type of the execution case event
**Enum values:** `"ones:test:execution_case:created"`
`"ones:test:execution_case:updated"`
`"ones:test:execution_case:removed"`
`"ones:test:execution_case:source_changed"`
`"ones:test:execution_case:source_change_resolved"`

timestamp * number
Timestamp when the event occurred

subscriberID * string
ID of the subscriber

eventData * object
organizationID * string
Organization that triggered the event.

teamID * string
Team that triggered the event.

triggerUserID string
User that triggered the event. May be omitted for a system-triggered event.

executionCaseID * string
ID of the execution case.
Min length:1

planIssueID * string
ID of the test plan issue containing the execution case.
Min length:1

sourceCaseIssueID * string
ID of the source test case issue for the execution case.
Min length:1

sourceVersionID string
ID of the relevant source test case version.

sourceChangeStatus string
For source_changed, the classification of this source version, which may differ from the execution case status retained from earlier changes. For a resolved event, this is the status before resolution.
**Enum values:** `"weak"`
`"strong"`

action string
Action used to resolve the source change.
**Enum values:** `"confirm_unaffected"`
`"sync_source"`

changes array
Actual field and step changes captured in the write transaction.
Min items:1
Array items:
item object
fieldID * string
Min length:1

fieldType string

valueType string

oldValue * any
Raw previous value; null for an empty single-value field, [] for an empty multi-reference field.

newValue * any
Raw updated value; null for a cleared single-value field, [] for a cleared multi-reference field.

stepID string
Min length:1

stepPosition integer

changeType string
**Enum values:** `"step_actual_result"`
`"step_execution_result"`

#### All of:

##### Option 1

**if :** any
eventType any
**const:** `"ones:test:execution_case:updated"`

**then :** any
eventData any
**required:** `changes`

##### Option 2

**if :** any
eventType any
**const:** `"ones:test:execution_case:source_changed"`

**then :** any
eventData any
**required:** `sourceVersionID, sourceChangeStatus`

##### Option 3

**if :** any
eventType any
**const:** `"ones:test:execution_case:source_change_resolved"`

**then :** any
eventData any
**required:** `sourceVersionID, sourceChangeStatus, action`

[Common structure](https://docs.ones.cn/developer/abilities/events/#http-body)

**eventData**

| Field | Type | Description |
| --- | --- | --- |
| `organizationID` | string | Organization that triggered the event. |
| `teamID` | string | Team that triggered the event. |
| `triggerUserID` | string | User that updated the execution case. |
| `executionCaseID` | string | ID of the execution case. |
| `planIssueID` | string | ID of the test plan issue containing the execution case. |
| `sourceCaseIssueID` | string | ID of the source test case issue for the execution case. |
| `changes` | object[] | Actual field and step changes with previous and new values. |

**changes[]**

| Field | Type | Description |
| --- | --- | --- |
| `fieldID` | string | ID of the changed execution case field. |
| `fieldType` | string | Field type, included for ordinary field changes. |
| `valueType` | string | Value type, included for ordinary field changes. |
| `oldValue` | any | Raw value before the update. Always present. |
| `newValue` | any | Raw value after the update. Always present. |
| `stepID` | string | Source step ID, included only for changes within a step. |
| `stepPosition` | integer | Step position, included only for changes within a step. |
| `changeType` | string | `step_actual_result` for actual results or `step_execution_result` for execution results. |

- Ordinary fields use raw scalar values; references use IDs. Multi-reference fields always use arrays and become `[]` when cleared. Cleared single-value fields use `null` . Step actual results use rich-text strings and become `""` when cleared.
- A step's actual result and execution result are separate changes with the same `fieldID` , `field179` . Repeated updates within one operation report the initial and final values.
- Changes follow the execution activity scope and exclude automatically maintained update time, last executor, last execution time, and other internal changes. Rich-text changes contain the full content.
- Values are captured in the write transaction and emitted after commit, without querying current values during asynchronous delivery. Deploy the events-api converter before the event producer.

## Example

```json
{
  "eventID": "Re6FSci9-1786000000000000002",
  "eventType": "ones:test:execution_case:updated",
  "timestamp": 1786000001000,
  "subscriberID": "Re6FSci9",
  "eventData": {
    "organizationID": "mkobhu1u",
    "teamID": "7A6aGmBc",
    "triggerUserID": "U1esfPni",
    "executionCaseID": "EC9HnuB1",
    "planIssueID": "PLAN9Hnu",
    "sourceCaseIssueID": "CASE9Hnu",
    "changes": [
      {
        "fieldID": "field164",
        "fieldType": "execution_result",
        "valueType": "single_reference_object",
        "oldValue": "to_do",
        "newValue": "passed"
      },
      {
        "fieldID": "field179",
        "stepID": "STEP9Hnu",
        "stepPosition": 1,
        "changeType": "step_execution_result",
        "oldValue": "to_do",
        "newValue": "passed"
      },
      {
        "fieldID": "field179",
        "stepID": "STEP9Hnu",
        "stepPosition": 1,
        "changeType": "step_actual_result",
        "oldValue": "",
        "newValue": "<p>As expected</p>"
      }
    ]
  }
}
```
