create_test_result
Record a new test execution result for a test case in a test run, appending to that item's execution history. Use to log status, comments and step results.
Instructions
Record a NEW execution of a run item (POST /testrun/{runKey}/testcase/{caseKey}/testresult). Appends to the execution history of that item — to amend the newest execution instead, use update_last_test_result. Only the fields you pass are sent, and the execution keeps the project default for everything you omit. The test case should already be an item of the run; if it is not, the behavior is VERSION-SPECIFIC — some Server builds silently ADD it to the run as a new item (verified live: testCaseCount grows; the new item's POSITION in items[] is not the head and not the tail — it landed second of three and second of four in two separate runs, so do not rely on where it appears), others reject the call with 400/404. Default statuses: 'Not Executed', 'In Progress', 'Pass', 'Fail', 'Blocked' — case-sensitive internal names; instances may define custom ones. scriptResults carry per-step outcomes of a STEP_BY_STEP script as { index (0-based), status, comment? }. An overall status sent TOGETHER with scriptResults is stored as sent (verified live: 'Blocked' with three 'Pass' steps stored 'Blocked') and is NEVER derived from the step statuses — scriptResults without a status leave the execution at the project default ('Not Executed'), so pass status in the SAME call. Some older builds may instead ignore the overall status: read the result back with get_test_run_results rather than sending a second update_last_test_result, which replaces the whole execution. A scriptResults entry whose index is past the last step of the case is discarded silently (HTTP 200, no error). When the same test case is an item of the run several times (e.g. once per environment or assignee), disambiguate with matchEnvironment / matchUserKey; with no selector the API picks one of them itself — measured live it took the FIRST (lowest-id) twin and left the other untouched, so pass a selector whenever the case appears more than once. Selectors only SELECT an existing item — they never set a value, so pass environment as well if the result should carry it. matchUserKey matches executedBy/userKey, not assignedTo. If nothing matches, this build answers 400 "No test execution found …" or an empty-bodied HTTP 500 — the 500 was first seen with matchEnvironment, but other inputs produce it too, so its cause is undetermined; that empty-bodied 500 has been observed to write the execution and add a duplicate item anyway, so the write may or may not have happened — re-read with get_test_run_results instead of retrying. Returns { id } of the created execution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Execution status. Default statuses: 'Not Executed', 'In Progress', 'Pass', 'Fail', 'Blocked' — case-sensitive internal names; instances may define custom ones. | |
| comment | No | Comment (HTML allowed) | |
| version | No | Jira release version name the execution belongs to, e.g. "2026.7" (case-sensitive) | |
| iteration | No | Iteration name as configured in the project (case-sensitive), for runs executed in iterations | |
| assignedTo | No | Assignee. Jira *user key* (e.g. 'JIRAUSER10000'), NOT a username or e-mail — resolve it with find_jira_user. | |
| executedBy | No | Executor. Jira *user key* (e.g. 'JIRAUSER10000'), NOT a username or e-mail — resolve it with find_jira_user. | |
| issueLinks | No | Jira issue keys to link, e.g. ["PROJ-123"] | |
| testRunKey | Yes | Test run (cycle) key, e.g. PROJ-R123 (PROJ-C123 on older instances) | |
| environment | No | Environment name as configured in the project (case-sensitive), e.g. "Chrome" | |
| testCaseKey | Yes | Test case key, e.g. PROJ-T123 — should already be one of the run's items | |
| customFields | No | Custom field values keyed by field name | |
| matchUserKey | No | Run-item selector, sent as the 'userKey' QUERY parameter (never in the body): targets the run item by its executor's Jira user key, e.g. 'JIRAUSER10000'. | |
| actualEndDate | No | ISO 8601 | |
| executionTime | No | Execution duration in milliseconds | |
| scriptResults | No | Per-step results (STEP_BY_STEP scripts) | |
| actualStartDate | No | ISO 8601, e.g. 2026-07-20T14:00:00Z | |
| matchEnvironment | No | Run-item selector, sent as the 'environment' QUERY parameter (never in the body): targets the run item with this environment (case-sensitive). Distinct from the 'environment' body field, which sets the environment recorded on the result. |