$npx -y skills add forcedotcom/sf-skills --skill dx-devops-test-suite-runRuns DevOps Center test suites on a pipeline stage (Pre-Promote, Post-Promote, or Review event) end to end: triggers async execution via the Connect API after an explicit confirmation gate, then polls by runId at provider-specific intervals until it completes, fails, or times out
| 1 | # Run a DevOps Center Test Suite |
| 2 | |
| 3 | Triggers a DevOps Center test suite execution and watches it to completion. Running and polling are two halves of one operation — never poll without first having (or being handed) a `runId`. |
| 4 | |
| 5 | > **API version:** All DevOps testing system calls target Salesforce API **v67.0** (minimum required). |
| 6 | |
| 7 | **Important:** All DevOps Center data lives in the Salesforce org — NOT the local repo. Always query the org with `sf data query` or `sf api request rest`. |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | ## Prerequisites |
| 12 | |
| 13 | Run the prerequisite checks in `references/prerequisite-checks.md` — Prerequisites 1–4 **and** Prerequisite 5 (stage), since this skill operates on a specific stage. You need the confirmed `doce-org-alias`, `pipelineId`, and `stageId`. |
| 14 | |
| 15 | ## Inputs required |
| 16 | |
| 17 | | Input | How to obtain | |
| 18 | |---|---| |
| 19 | | `pipelineId` | Prerequisite 4 (pipeline selection) | |
| 20 | | `stageId` | Prerequisite 5 (pipeline stage confirmation) | |
| 21 | | `event` | Confirm with user: `Pre-Promote`, `Post-Promote`, or `Review` | |
| 22 | | `testSuiteIds` | Confirmed suite IDs from selection or recommendation | |
| 23 | | `doce-org-alias` | Prerequisite 1 | |
| 24 | |
| 25 | --- |
| 26 | |
| 27 | ## Step 1 — Trigger execution |
| 28 | |
| 29 | ### Confirmation gate |
| 30 | |
| 31 | **This call mutates org state — do not proceed without explicit user confirmation.** Before calling the API, show: |
| 32 | |
| 33 | > "I'm about to run tests with the following configuration: |
| 34 | > - Pipeline: `<pipelineName>` |
| 35 | > - Stage: `<stageName>` |
| 36 | > - Event: `<event>` |
| 37 | > - Suite(s): `<suiteName(s)>` |
| 38 | > - Org: `<doce-org-alias>` |
| 39 | > |
| 40 | > Shall I proceed?" |
| 41 | |
| 42 | Do not make the API call until the user confirms. |
| 43 | |
| 44 | ### API call |
| 45 | |
| 46 | ```bash |
| 47 | sf api request rest \ |
| 48 | "/services/data/v67.0/connect/devopstesting/pipeline/<pipelineId>/stage/execute" \ |
| 49 | --method POST \ |
| 50 | --body '{ |
| 51 | "stageId": "<stageId>", |
| 52 | "event": "<event>", |
| 53 | "testSuiteIds": ["<suiteId1>", "<suiteId2>"] |
| 54 | }' \ |
| 55 | --target-org <doce-org-alias> |
| 56 | ``` |
| 57 | |
| 58 | | Field | Type | Description | |
| 59 | |---|---|---| |
| 60 | | `stageId` | string | The ID of the pipeline stage to execute tests on | |
| 61 | | `event` | string | `Pre-Promote`, `Post-Promote`, or `Review` | |
| 62 | | `testSuiteIds` | string[] | One or more test suite IDs to execute | |
| 63 | |
| 64 | ### On success |
| 65 | |
| 66 | Extract the `runId` (execution ID) from the response. Inform the user: |
| 67 | |
| 68 | > "Tests are running in `<doce-org-alias>`. I'll update you when results are ready." |
| 69 | |
| 70 | Then proceed **immediately** to Step 2 (polling) with the `runId`. |
| 71 | |
| 72 | ### On error |
| 73 | |
| 74 | See `references/error-handling.md`. If the org rejects execution (e.g. `environmentId: null`, or `classIdList is null or empty — no tests to execute`), read the actual error, explain the root cause and required fix in plain language, and finish cleanly. **Do not retry in a loop and do not fabricate a `runId` or results.** |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## Step 2 — Poll until completion |
| 79 | |
| 80 | **Confirmation required:** No — polling is automatic and read-only. |
| 81 | |
| 82 | Poll the execution record by `runId` at the provider-appropriate interval. Full intervals, timeout behavior, and the poll query are in `references/polling-configuration.md`. |
| 83 | |
| 84 | Summary of the loop (the `runId` is a `DevopsTestSuiteExecution` Id — poll that object, not `DevopsTestExecution`): |
| 85 | - Query `DevopsTestSuiteExecution` by `runId` each interval for `Status, Coverage, SuccessCount, FailureCount, QualityGateStatus`. |
| 86 | - `InProgress` → wait and poll again. |
| 87 | - `Passed` / `Failed` → surface `Coverage`, `SuccessCount`, `FailureCount`, and `QualityGateStatus` inline (no raw JSON). If `FailureCount > 0`, fetch the child `DevopsTestExecution` failure rows and hand off to **`dx-devops-test-failures-analyze`**. |
| 88 | - `Error` → the run itself errored (not test failures); surface `ResultDetails`/`Message` in plain language and offer retry or skip. |
| 89 | - **Timeout** → surface the `runId`, do NOT auto-retry, wait for user instruction. |
| 90 | |
| 91 | --- |
| 92 | |
| 93 | ## Retrigger mode (re-running a quality gate) |
| 94 | |
| 95 | Use when a promotion was blocked by a gate failure and the coverage gap has since been addressed. **All preconditions, gate, and the retrigger API call are |