Run a Playlist
Start a Tosca playlist execution and optionally poll until completion.
Always use --json --silent on every toscactl command.
Steps
Parse arguments. Extract from
$ARGUMENTS:- Playlist name or ID (required)
--param KEY=VALUEpairs (optional, repeatable)--privateflag (optional)--waitflag (optional — block until the run completes)--assert-successflag (optional — exit non-zero if the run does not succeed; requires--wait)--report FORMAT --report-path PATH(optional — write a results report to disk after the run;junitis the only supported format; implies--wait; report is written before--assert-successso failing runs still produce the file)
Start the run.
toscactl playlists run start <name_or_id> --json --silent [--private] [--param KEY=VALUE...] [--wait] [--assert-success]Extract the run ID from the JSON response.
Poll for completion (if
--waitwas specified):- The
--waitflag makestoscactlpoll automatically every 5 seconds and print live progress until a terminal state is reached. No manual polling loop needed. - If
--waitwas not specified, poll manually:- Run
toscactl playlists run view <run_id> --json --silent - Check the
statefield in the response. - Terminal states: Succeeded, Failed, Cancelled, Error — stop polling.
- Non-terminal states: Running, Pending, Queued — continue polling.
- Poll every 5 seconds.
- Report progress between polls (e.g., "Run is still Running, checking again in 5s...").
- Run
- The
Report results.
- Show: run ID, final state, duration.
- Show pass/fail counts for test cases.
- If the run failed, list the failing test case names and their states.
Error Handling
- If the playlist is not found, suggest using
/tosca-findto search for it first. - If the run fails to start, check auth with
toscactl config --json --silent. - If using
--wait, the CLI polls indefinitely until a terminal state. If manual polling seems stuck, report the last known state and provide the run ID so the user can check later with/tosca-status. - Use
--assert-successin CI pipelines to fail the build on a failed run. The flag only takes effect with--wait(the CLI errors if--assert-successis passed alone). Exits 0 onsucceeded, non-zero otherwise.