UiPath Documentation
uipath-cli
latest
false
UiPath CLI user guide

uip tm attachment

Syntax and options for `uip tm attachment`, which downloads and uploads files associated with test case logs in a test execution.

uip tm attachment downloads and uploads files associated with test case logs in a test execution — screenshots, serialized state, recorded logs, any file the automation attached to a log.

Synopsis​

uip tm attachment download --execution-id <uuid> (--project-id <id> | --project-key <key> | --test-set-key <key>)
                           [--test-case-name <name>]… [--only-failed] [--result-path <path>]

uip tm attachment upload --object-id <uuid> --object-type <type> --file <path>
                         (--project-id <id> | --project-key <key> | --test-set-key <key>)
                         [--source <source>] [--attachment-type <type>]
uip tm attachment download --execution-id <uuid> (--project-id <id> | --project-key <key> | --test-set-key <key>)
                           [--test-case-name <name>]… [--only-failed] [--result-path <path>]

uip tm attachment upload --object-id <uuid> --object-type <type> --file <path>
                         (--project-id <id> | --project-key <key> | --test-set-key <key>)
                         [--source <source>] [--attachment-type <type>]

All verbs honor the global options and the standard exit codes. Every verb accepts --log-level <level> (default Information).

Both verbs need a project. Pass --project-id, --project-key, or --test-set-key. When you pass more than one, --project-id wins, then --project-key, then the project key derived from the --test-set-key prefix. If you pass none of them, the command fails with ErrorCode: invalid_argument.

uip tm attachment download​

Download attachments for the test case logs of a single execution. The command pages through the logs, optionally narrows to failed-only or to named test cases, then downloads the files of each test case log into a per-test-case subdirectory under --result-path.

For each test case log, the command downloads:

  • The attachments of the test case log.
  • The assertion screenshots, when the execution type is automated or mixed.
  • The attachments of each test step log, when the execution type is manual or mixed.

Arguments​

None.

Options​

  • --execution-id <uuid> (required) — execution whose attachments to pull.
  • --project-id <id> — Test Manager project ID. Wins if --project-key is also given.
  • --project-key <key> — Test Manager project key (for example, DEMO). Ignored if --project-id is also given.
  • --test-set-key <key> — test set key (for example, DEMO:42); the project key is derived from the prefix.
  • --test-case-name <name> — filter by test case name (case-insensitive substring). Can be repeated to accept any of several names.
  • --only-failed — download attachments only for test case logs with result Failed.
  • --result-path <path> — output directory. Defaults to the current working directory. The directory is created if missing.

Examples​

# download everything
uip tm attachment download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --result-path ./attachments

# only failed tests
uip tm attachment download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --only-failed \
  --test-case-name login \
  --test-case-name checkout \
  --result-path ./attachments
# download everything
uip tm attachment download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --result-path ./attachments

# only failed tests
uip tm attachment download \
  --execution-id a1b2c3d4-0000-0000-0000-000000000001 \
  --project-key DEMO \
  --only-failed \
  --test-case-name login \
  --test-case-name checkout \
  --result-path ./attachments

Data shape — normal run​

{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "OutputPath": "./attachments",
    "Downloaded": 3,
    "MatchedTestCases": 2
  }
}
{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "OutputPath": "./attachments",
    "Downloaded": 3,
    "MatchedTestCases": 2
  }
}

Data shape — no matching test case logs​

{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Message": "No matching test case logs found.",
    "Downloaded": 0
  }
}
{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "Message": "No matching test case logs found.",
    "Downloaded": 0
  }
}

Data shape — some attachments failed​

{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "OutputPath": "./attachments",
    "Downloaded": 2,
    "MatchedTestCases": 3,
    "Skipped": ["Login flow: HTTP 404: Not Found"]
  }
}
{
  "Code": "AttachmentDownload",
  "Data": {
    "ExecutionId": "a1b2c3d4-0000-0000-0000-000000000001",
    "OutputPath": "./attachments",
    "Downloaded": 2,
    "MatchedTestCases": 3,
    "Skipped": ["Login flow: HTTP 404: Not Found"]
  }
}

uip tm attachment upload​

Upload a file as an attachment to a test case log or other Test Manager object. Passing --source or --attachment-type uploads the file as a tagged attachment.

Arguments​

None.

Options​

  • --object-id <uuid> (required) — UUID of the object to attach the file to (for example, a test case log ID).
  • --object-type <type> (required) — type of the object. One of project, requirement, testCase, testSet, testExecution, testStepLog, testCaseLog, defect, testCaseLogAssertion, testCaseLogSnapshot, explorationResult.
  • --file <path> (required) — local path to the file to upload.
  • --project-id <id> — Test Manager project ID. Wins if --project-key is also given.
  • --project-key <key> — Test Manager project key (for example, DEMO). Ignored if --project-id is also given.
  • --test-set-key <key> — test set key (for example, DEMO:42); the project key is derived from the prefix.
  • --source <source> — upload source of a tagged attachment. One of none, autonomousExecution, autonomousExploration.
  • --attachment-type <type> — attachment type of a tagged attachment. One of none, stepExecutionTrace, stepVerificationTrace.

Examples​

# upload a screenshot to a test case log
uip tm attachment upload \
  --object-id a1b2c3d4-0000-0000-0000-000000000001 \
  --object-type testCaseLog \
  --project-key DEMO \
  --file ./screenshot.png

# upload an autonomous-execution trace as a tagged attachment
uip tm attachment upload \
  --object-id a1b2c3d4-0000-0000-0000-000000000001 \
  --object-type testCaseLog \
  --project-id 9dfdc3ca-fc75-0100-2aae-0b46e318b723 \
  --file ./trace.png \
  --source autonomousExecution \
  --attachment-type stepExecutionTrace
# upload a screenshot to a test case log
uip tm attachment upload \
  --object-id a1b2c3d4-0000-0000-0000-000000000001 \
  --object-type testCaseLog \
  --project-key DEMO \
  --file ./screenshot.png

# upload an autonomous-execution trace as a tagged attachment
uip tm attachment upload \
  --object-id a1b2c3d4-0000-0000-0000-000000000001 \
  --object-type testCaseLog \
  --project-id 9dfdc3ca-fc75-0100-2aae-0b46e318b723 \
  --file ./trace.png \
  --source autonomousExecution \
  --attachment-type stepExecutionTrace

Data shape​

{
  "Code": "AttachmentUpload",
  "Data": {
    "FileName": "trace.png",
    "ObjectId": "a1b2c3d4-0000-0000-0000-000000000001",
    "ObjectType": "testCaseLog",
    "Source": "autonomousExecution",
    "AttachmentType": "stepExecutionTrace"
  }
}
{
  "Code": "AttachmentUpload",
  "Data": {
    "FileName": "trace.png",
    "ObjectId": "a1b2c3d4-0000-0000-0000-000000000001",
    "ObjectType": "testCaseLog",
    "Source": "autonomousExecution",
    "AttachmentType": "stepExecutionTrace"
  }
}

Source and AttachmentType appear only for tagged uploads.

  • testsets run — produces the ExecutionId used by download.
  • wait — block until the execution is terminal before pulling attachments.
  • result — JUnit XML of the same execution.
  • report — human-readable summary.

See also​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated