# uip tm result

> Download execution artifacts in CI-friendly formats using `uip tm result`, including JUnit XML for test dashboards.

`uip tm result` downloads execution artifacts in a structured, CI-friendly format. Today it has one verb, which writes a JUnit XML file — the lingua franca consumed by most CI test dashboards (Azure DevOps, Jenkins, GitLab, CircleCI).

## Synopsis

```
uip tm result download --execution-id <uuid> (--project-key <key> | --test-set-key <key>) [--result-path <path>]
```

All verbs honor the [global options](./global-options.md) and the standard [exit codes](./exit-codes.md). Every verb accepts `-t, --tenant <name>` and `--log-level <level>` (default `Information`).

## uip tm result download

Download the results of a single test execution as a JUnit XML report. The command:

1. Fetches the execution's stats, test set name, and test set ID.
2. Pages through every test case log attached to the execution.
3. For each log, fetches the per-assertion artifacts in parallel (assertion lookup failures are logged and skipped, not fatal).
4. Fetches the test set's package list (best-effort — missing packages are silently omitted).
5. Serializes everything as JUnit XML and writes it to `--result-path`.

Link and web-URL fields inside the XML point back to the Test Manager web UI using the organization slug and tenant name of the current session.

### Arguments

None.

### Options

- `--execution-id <uuid>` *(required)* — execution to download.
- `--project-key <key>` — owning project. Either this or `--test-set-key` is required.
- `--test-set-key <key>` — test set key (e.g. `DEMO:42`); the project key is derived from the prefix.
- `--result-path <path>` — output location. Can be a file (`./junit.xml`) or a directory (the file is named after the test set). Defaults to the current working directory.

### Example

```bash
uip tm result download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --result-path ./junit.xml
```

### Data shape

```json
{
  "Code": "ResultDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Format": "junit",
    "OutputPath": "./junit.xml",
    "TotalTests": 10,
    "Passed": 8,
    "Failed": 2,
    "Cancelled": 0
  }
}
```

The actual JUnit XML is written to `OutputPath`. The JSON envelope only reports success plus summary counts.

:::note
The output format is fixed to JUnit XML today. `Format` is included in the envelope so that future versions can add more formats (for example, NUnit or TRX) without a breaking change to the shape.
:::

### Using the output in CI

Publish the XML file with whatever test-reporter task your CI provides. Typical patterns:

```yaml
# Azure DevOps
- task: PublishTestResults@2
  inputs:
    testResultsFormat: JUnit
    testResultsFiles: junit.xml
```

```yaml
# GitHub Actions (via a community action)
- uses: dorny/test-reporter@v1
  with:
    name: Test Manager
    path: junit.xml
    reporter: java-junit
```

## Related

- [testsets run](./uip-test-manager-testsets.md#uip-tm-testsets-run) — produces the `ExecutionId` consumed here.
- [wait](./uip-test-manager-wait.md) — block until the execution is in a terminal state before downloading results.
- [report](./uip-test-manager-report.md) — a human-readable summary (same data, different shape) if you do not need JUnit XML.
- [attachment](./uip-test-manager-attachment.md) — download the screenshots, logs, and files produced by test case logs.

## See also

- [Test Manager overview](./uip-test-manager.md)
- [Scripting patterns](./scripting-patterns.md)
