UiPath Documentation
uipath-cli
2026.10
false
UiPath-CLI-Benutzerhandbuch

So: Führen Sie Tests über die CLI aus

Führen Sie einen Test Manager-Testsatz über die UiPath CLI als Teil einer CI-Pipeline aus und interpretieren Sie das Ausführungswort korrekt.

This page shows how to run a UiPath Test Manager test set from the CLI as part of a CI pipeline — and, just as importantly, how to read the verdict correctly. The uip tm tool splits a test set run into three verbs; the launch verb alone exits 0 even when tests fail.

Die Goldregel: Starten → Warten → Überprüfen​

uip tm testsets run on its own does not exit non-zero because tests failed. Getting a pipeline to fail on a red test set run takes the wait step, and the verify step gives the details (a package run takes one command, see Run every test in a local project or an uploaded package):

  1. Starten – uip tm testsets run. Stellt die Ausführung in eine Warteschlange ein und beendet 0 , sobald der Orchestrator die Anforderung akzeptiert. Status: "Running" in der Antwort spiegelt den Status beim Start wider, nicht das Endergebnis.
  2. Block — uip tm wait. Polls until the execution reaches a terminal state (Finished or Cancelled). Exits 0 when the execution finished with no failed test, 1 when a test failed or the run was cancelled, and 4 on --timeout. Tests with no result do not fail the wait.
  3. Verify — uip tm report get. Reads Data.Failed (and Passed, None, PassRate) and the failed test cases. Exits 0 whenever it successfully fetches the summary, regardless of pass/fail.

A launch+wait shortcut exists for test sets — uip tm testsets run --wait launches and blocks in one call (--timeout/--poll-interval tune the poll) and uses the same exit codes as wait: 1 when a test failed or the run was cancelled, 4 on timeout. Use the verify step to print which test cases failed, or to fail the build on tests with no result.

Run every test in a local project or an uploaded package​

When the tests are in a local RPA test project, or ship in a package already uploaded to Orchestrator, uip tm run --type package launches, waits, and verifies in one call. With --project-path, it also packs and uploads the project first. It runs every test case in the package, with no test set to author, writes a JUnit or UiPath report to --result-path, and exits 1 when a test fails or reports no result, no test runs, or the run is cancelled, so the pipeline fails on a red run without a separate verify step.

# a package already uploaded to Orchestrator
uip tm run --type package \
  --project-key DEMO \
  --package-name MyTests \
  --package-version 1.0 \
  --folder-path Shared \
  --result-path ./results/junit.xml

# a local RPA test project: pack, upload, and run
uip tm run --type package \
  --project-key DEMO \
  --project-path ./MyTests/project.json \
  --folder-path Shared \
  --result-path ./results/junit.xml
# a package already uploaded to Orchestrator
uip tm run --type package \
  --project-key DEMO \
  --package-name MyTests \
  --package-version 1.0 \
  --folder-path Shared \
  --result-path ./results/junit.xml

# a local RPA test project: pack, upload, and run
uip tm run --type package \
  --project-key DEMO \
  --project-path ./MyTests/project.json \
  --folder-path Shared \
  --result-path ./results/junit.xml

As soon as the execution starts, the command prints Execution started: <link> on stderr, so the CI log links to the run in Test Manager while the tests are still running.

Lassen Sie --project-key aus, um das Paket im Standardprojekt des Mandanten auszuführen; Data.ProjectKey in der Ausgabe benennt das Projekt, in dem die Tests ausgeführt wurden.

Code beendenBedeutung
0Jeder Test bestanden.
1Ein Test ist fehlgeschlagen oder hat kein Ergebnis gemeldet, die Ausführung wurde abgebrochen, es wurde kein Test durchgeführt oder ein Serviceaufruf ist fehlgeschlagen. Eine fehlende Anmeldung oder kein Zugriff auf ein Projekt, das Sie übergeben haben, wird auch 1 beendet, bevor die Ausführung beginnt.
2Anmelde- oder Berechtigungsproblem nach dem Start der Ausführung oder keine Berechtigung zum Öffnen oder Erstellen des Mandanten-Standardprojekts.
3Falsche Option oder Eingabe.
4Die Ausführung hat --timeout überschritten.

Minimales funktionierendes Snippet​

#!/usr/bin/env bash
set -euo pipefail

# 1. Launch
EXECUTION_ID=$(uip tm testsets run \
  --test-set-key DEMO:10 \
  --output-filter "ExecutionId" \
  --output plain)

# 2. Block (default timeout: 30 min; adjust with --timeout)
code=0
uip tm wait \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO \
  --timeout 1800 || code=$?

if [ "$code" -eq 4 ]; then
  echo "test run did not finish within 30 minutes" >&2
  exit 4
fi

# 3. Verify
FAILED=$(uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO \
  --output-filter "Failed" \
  --output plain)

if [ "$FAILED" -gt 0 ]; then
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi

if [ "$code" -ne 0 ]; then
  echo "wait failed or the run was cancelled (exit $code)" >&2
  exit "$code"
fi

echo "all tests passed"
#!/usr/bin/env bash
set -euo pipefail

# 1. Launch
EXECUTION_ID=$(uip tm testsets run \
  --test-set-key DEMO:10 \
  --output-filter "ExecutionId" \
  --output plain)

# 2. Block (default timeout: 30 min; adjust with --timeout)
code=0
uip tm wait \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO \
  --timeout 1800 || code=$?

if [ "$code" -eq 4 ]; then
  echo "test run did not finish within 30 minutes" >&2
  exit 4
fi

# 3. Verify
FAILED=$(uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO \
  --output-filter "Failed" \
  --output plain)

if [ "$FAILED" -gt 0 ]; then
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi

if [ "$code" -ne 0 ]; then
  echo "wait failed or the run was cancelled (exit $code)" >&2
  exit "$code"
fi

echo "all tests passed"

--output plain gibt den einfachen Wert für ein skalares Filterergebnis zurück; Dies ist die sicherste Methode, um ein Feld in einer Shell-Variablen zu erfassen, ohne JSON zu parsen. Siehe Skriptmuster – Lesen von Werten aus dem Umschlag.

Auswahl von Eingaben für die Befehle​

uip tm testsets run benötigt den Testsatzschlüssel, nicht seine UUID. Der Schlüssel hat das Format <ProjectKey>:<Number> – z. B. DEMO:10. Zwei Möglichkeiten, sie zu finden:

# From the Test Manager UI — it is the "Key" column in the test set list.

# Or from the CLI:
uip tm testsets list --project-key DEMO --filter smoke \
  --output-filter "[*].{key:TestSetKey, name:Name}"
# From the Test Manager UI — it is the "Key" column in the test set list.

# Or from the CLI:
uip tm testsets list --project-key DEMO --filter smoke \
  --output-filter "[*].{key:TestSetKey, name:Name}"

list nimmt das Projekt als --project-key oder --project-id. run leitet das Projekt vom Präfix des Testsatzschlüssels ab (DEMO:10 → Projekt DEMO).

Wenn Sie die numerische UUID für uip tm executions list --test-set-id benötigen, ist dies das Id -Feld in derselben Listenausgabe – nicht TestSetKey.

Auswählen, welche Fälle ausgeführt werden​

uip tm testsets run --execution-type steuert, welche Testfälle innerhalb des Satzes ausgeführt werden:

  • automated (Standard) – nur automatisierte Testfälle.
  • manual – nur manuelle Testfälle.

Any other value is refused with exit code 3.

Behalten Sie für CI den Standardwert (automated) bei – manuelle Fälle erfordern einen Menschen, um „bestanden“/fehlgeschlagen zu markieren, und bleiben InProgress bis --timeout.

Parameterüberschreibungen werden übergeben​

Wenn der Testsatz Parameter verfügbar macht (z. B. eine Ziel-URL oder eine Konto-ID), überschreiben Sie sie beim Start mit --input-path:

cat > ./params.json <<'EOF'
[
  {"name": "TargetUrl", "type": "String", "value": "https://staging.example.com"},
  {"name": "AccountId", "type": "String", "value": "acme-staging"}
]
EOF

uip tm testsets run --test-set-key DEMO:10 --input-path ./params.json
cat > ./params.json <<'EOF'
[
  {"name": "TargetUrl", "type": "String", "value": "https://staging.example.com"},
  {"name": "AccountId", "type": "String", "value": "acme-staging"}
]
EOF

uip tm testsets run --test-set-key DEMO:10 --input-path ./params.json

Überschreibungen werden mit den aktuellen Parameterdefinitionen des Testsatzes durch name (keine Beachtung von Groß-/Kleinschreibung) und, falls vorhanden, type abgeglichen. Wenn der Server keine Parameterdefinitionen meldet, werden die Eingaben unverändert gesendet. Die Überschreibungen werden im Testsatz gespeichert, sodass sie bei späteren Ausführungen ohne --input-path wiederverwendet werden.

Lesen des Urteils im Detail​

uip tm report get ist der Leser der Zusammenfassung. Die Standardausgabe gibt Ihnen die Bewertungskarte; Übergeben Sie --query (einen Filter im JQ-Stil), um eine Teilmenge in einem Aufruf zu extrahieren:

# Pretty scorecard
uip tm report get --execution-id "$EXECUTION_ID" --project-key DEMO

# Script-friendly — JSON with just the counts
uip tm report get --execution-id "$EXECUTION_ID" --project-key DEMO \
  --query '{total: .TotalTests, passed: .Passed, failed: .Failed}'
# Pretty scorecard
uip tm report get --execution-id "$EXECUTION_ID" --project-key DEMO

# Script-friendly — JSON with just the counts
uip tm report get --execution-id "$EXECUTION_ID" --project-key DEMO \
  --query '{total: .TotalTests, passed: .Passed, failed: .Failed}'

Der Umschlag Data hat die folgenden Felder (vollständiges Schema in der report get -Referenz):

  • TotalTests, Passed, Failed, None (Tests ohne Ergebnis), PassRate (eine Zahl wie 80, berechnet über die erfolgreichen oder fehlgeschlagenen Tests), Duration (HH:MM:SS).
  • FailedTests – Ein Eintrag pro fehlgeschlagenem Testfall mit TestCaseName und einer Error -Zeichenfolge (entweder das info -Feld des Protokolls oder eine verkettete Liste fehlgeschlagener Assertionsnachrichten).

Wenn Sie eine JUnit-XML-Datei benötigen, die das Test-Dashboard Ihrer CI erfassen kann, verwenden Sie uip tm result download anstelle (oder neben) report get.

Fehlgeschlagene Fälle in CI-Protokollen anzeigen​

Verwandeln Sie das FailedTests -Array pro Fehler in eine visuell lesbare Zeile, bevor Sie die Pipeline beenden:

if [ "$FAILED" -gt 0 ]; then
  uip tm report get \
    --execution-id "$EXECUTION_ID" \
    --project-key DEMO \
    --output-filter "FailedTests[*].[TestCaseName, Error]" \
    --output plain >&2
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi
if [ "$FAILED" -gt 0 ]; then
  uip tm report get \
    --execution-id "$EXECUTION_ID" \
    --project-key DEMO \
    --output-filter "FailedTests[*].[TestCaseName, Error]" \
    --output plain >&2
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi

Für eine tiefere Fehleranalyse – Assertion-für-Assertion-Details zu einem einzelnen fehlgeschlagenen Fall – verwenden Sie uip tm testcaselog list-assertions für die Protokoll-IDs, die von uip tm executions testcaselogs list --only-failed zurückgegeben werden.

Fehlerhafte Fälle werden wiederholt​

Wenn eine Ausführung Fehler aufweist, die fehlerhaft sein könnten (Zeitpunkt, Umgebung), wiederholen Sie nur die fehlgeschlagenen Fälle :

uip tm executions retry \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO
uip tm executions retry \
  --execution-id "$EXECUTION_ID" \
  --project-key DEMO

uip tm executions retry verwendet dieselbe Ausführungs-ID wieder – es wird keine neue erstellt. Wenn es keine Fehler beim Wiederholen gibt, wird eine Informationsmeldung ausgegeben und 0 wird beendet (absichtlich kein Fehler).

After retry, loop back through wait + report get on the same execution ID. For a package run, uip tm run --max-retries <count> re-runs failed test cases within the same command.

Häufige Fallstricke​

  • Parsing testsets run output to decide pass/fail. The Status field at launch is typically Running — it means the run was queued, not that every test passed. Always call wait, or pass --wait, and read the exit code.
  • --timeout auf wait wird vergessen. Der Standardwert ist 1800 Sekunden (30 Minuten). Übergeben Sie 0 um unbegrenzt zu warten (selten, was Sie bei CI möchten); übergeben Sie eine größere Zahl für lange Suiten.
  • Treating exit 1 from wait as an infrastructure failure only. wait exits 1 when a test failed or the run was cancelled, as well as when polling fails; Code in the envelope is ExecutionTestsFailed or ExecutionCancelled for the first two. A timeout exits 4 — see uip tm wait exit codes.
  • Verwenden von testsets Verben zum Erstellen von Tests. Testfälle und deren Links zu Orchestrator-Automatisierungen stammen von uip tm testcases; testsets gruppiert sie nur.

Vollständiges CI-fähiges Beispiel​

Ein Bash-Snippet für einen Pipelineschritt – der Build schlägt fehl, wenn ein Test fehlschlägt, eine Zeitüberschreitung oder Fehler auftritt:

#!/usr/bin/env bash
set -euo pipefail

TEST_SET_KEY="${TEST_SET_KEY:?TEST_SET_KEY is required}"
PROJECT_KEY="${PROJECT_KEY:?PROJECT_KEY is required}"
TIMEOUT="${TEST_TIMEOUT:-1800}"

EXECUTION_ID=$(uip tm testsets run \
  --test-set-key "$TEST_SET_KEY" \
  --output-filter "ExecutionId" \
  --output plain)

echo "started execution $EXECUTION_ID" >&2

code=0
uip tm wait \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY" \
  --timeout "$TIMEOUT" || code=$?

if [ "$code" -eq 4 ]; then
  echo "execution $EXECUTION_ID did not finish within ${TIMEOUT}s" >&2
  exit 4
fi

# Get the scorecard and the names of any failed cases in one shot
uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY"

FAILED=$(uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY" \
  --output-filter "Failed" \
  --output plain)

if [ "$FAILED" -gt 0 ]; then
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi

if [ "$code" -ne 0 ]; then
  echo "wait failed or the run was cancelled (exit $code)" >&2
  exit "$code"
fi

echo "all tests passed"
#!/usr/bin/env bash
set -euo pipefail

TEST_SET_KEY="${TEST_SET_KEY:?TEST_SET_KEY is required}"
PROJECT_KEY="${PROJECT_KEY:?PROJECT_KEY is required}"
TIMEOUT="${TEST_TIMEOUT:-1800}"

EXECUTION_ID=$(uip tm testsets run \
  --test-set-key "$TEST_SET_KEY" \
  --output-filter "ExecutionId" \
  --output plain)

echo "started execution $EXECUTION_ID" >&2

code=0
uip tm wait \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY" \
  --timeout "$TIMEOUT" || code=$?

if [ "$code" -eq 4 ]; then
  echo "execution $EXECUTION_ID did not finish within ${TIMEOUT}s" >&2
  exit 4
fi

# Get the scorecard and the names of any failed cases in one shot
uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY"

FAILED=$(uip tm report get \
  --execution-id "$EXECUTION_ID" \
  --project-key "$PROJECT_KEY" \
  --output-filter "Failed" \
  --output plain)

if [ "$FAILED" -gt 0 ]; then
  echo "$FAILED test case(s) failed" >&2
  exit 1
fi

if [ "$code" -ne 0 ]; then
  echo "wait failed or the run was cancelled (exit $code)" >&2
  exit "$code"
fi

echo "all tests passed"

Führen Sie dieses Skript nach Ihrem Schritt zur Lösungsbereitstellung in einem der CI-Rezepte aus. Die einzige env-spezifische Konfiguration ist TEST_SET_KEY / PROJECT_KEY – legen Sie sie pro Umgebung in der Pipeline fest, und mit demselben Skript wird sauber über dev/stage/prod hinweg heraufgestuft.

Siehe auch​

War diese Seite hilfreich?

Verbinden

Benötigen Sie Hilfe? Support(opens in new window)

Möchten Sie lernen? UiPath Academy(opens in new window)

Haben Sie Fragen? UiPath-Forum(opens in new window)

Auf dem neuesten Stand bleiben