> ## Documentation Index
> Fetch the complete documentation index at: https://uiform-codex-generated-frontend-snippets.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Workflow Test Run

> Retrieve a single workflow test run.

Identified by `run_id`. Returns the run with its lifecycle status, timing,
and pass/fail counts. Returns 404 if no run with that ID exists.

Fetch a workflow-test run by `run_id`. Use this while polling for
`lifecycle.status`, then fetch the child results with [List Test Run Results](/api-reference/workflows/tests/results/list).

<RequestExample>
  ```python Python theme={null}
  from retab import Retab

  client = Retab()

  run = client.workflows.tests.runs.get("wftestrun_q1z2")

  print(run.lifecycle.status)
  print(run.counts)
  ```

  ```typescript TypeScript theme={null}
  import { Retab } from "@retab/node";

  const client = new Retab({ apiKey: process.env.RETAB_API_KEY });

  const run = await client.workflows.tests.runs.get("wftestrun_q1z2");

  console.log(run.lifecycle.status);
  console.log(run.counts);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	retab "github.com/retab-dev/retab/clients/go"
  )

  func ptr[T any](v T) *T { return &v }

  func main() {
  	ctx := context.Background()

  	client, err := retab.NewClient("")
  	if err != nil {
  		log.Fatal(err)
  	}

  	run, err := client.Workflows.Tests.Runs.Get(
  		ctx,
  		"wftestrun_q1z2",
  	)
  	if err != nil {
  		log.Fatal(err)
  	}

  	fmt.Println(run.Lifecycle.Status())
  	fmt.Println(run.Counts)
  }
  ```

  ```ruby Ruby theme={null}
  require 'retab'

  client = Retab::Client.new(api_key: ENV['RETAB_API_KEY'])

  run = client.workflow_test_runs.get(run_id: 'wftestrun_q1z2')

  puts run.lifecycle.status
  puts run.counts
  ```

  ```rust Rust theme={null}
  use retab::Retab;

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = Retab::new(std::env::var("RETAB_API_KEY")?);

      let run = client.workflows().tests().runs().get("wftestrun_q1z2").await?;
      println!("{:?}", run.lifecycle);
      println!("{:?}", run.counts);
      Ok(())
  }
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Retab\Client;

  $client = new Client(apiKey: getenv('RETAB_API_KEY'));

  $result = $client->workflowTestRuns()->get(
      runId: 'run_abc123',
  );
  print_r($result);
  ```

  ```csharp C# theme={null}
  using Retab;
  using RetabClient = Retab.Retab;

  var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;
  var client = new RetabClient(apiKey);

  var result = await client.Workflows.Tests.Runs.GetAsync("run_abc123");
  Console.WriteLine(result);
  ```

  ```java Java theme={null}
  import com.retab.RetabClient;

  public final class Example {
    public static void main(String[] args) throws Exception {
      RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY"));

      var result = client.workflows().tests().runs().get("run_abc123");
      System.out.println(result);
    }
  }
  ```

  ```curl cURL theme={null}
  curl -X 'GET' \
    'https://api.retab.com/v1/workflows/tests/runs/wftestrun_q1z2' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer <your-api-key>'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "wftestrun_q1z2",
    "workflow": {
      "workflow_id": "wf_abc123xyz",
      "version_id": "draft_2026_05_18"
    },
    "trigger": { "type": "api" },
    "lifecycle": { "status": "completed" },
    "timing": {
      "created_at": "2026-05-18T10:00:00Z",
      "started_at": "2026-05-18T10:00:01Z",
      "completed_at": "2026-05-18T10:00:29Z",
      "duration_ms": 28000
    },
    "test_id": "wfnodetest_hsLEQiM61ez9Piv147MWk",
    "target": { "type": "block", "block_id": "block_extract_invoice" },
    "total_tests": 1,
    "counts": {
      "queued": 0,
      "running": 0,
      "passed": 1,
      "failed": 0,
      "blocked": 0,
      "error": 0,
      "cancelled": 0
    }
  }
  ```

  ```json 404 theme={null}
  {
    "detail": "Workflow test run not found: wftestrun_q1z2"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/workflows/tests/runs/{run_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/workflows/tests/runs/{run_id}:
    get:
      tags:
        - Workflows
        - Workflow Tests
      summary: Get Test Execution Run
      description: >-
        Retrieve a single workflow test run.


        Identified by `run_id`. Returns the run with its lifecycle status,
        timing,

        and pass/fail counts. Returns 404 if no run with that ID exists.
      operationId: get_test_execution_run
      parameters:
        - in: path
          name: run_id
          required: true
          schema:
            type: string
            title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowTestRun'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WorkflowTestRun:
      properties:
        id:
          type: string
          title: Id
        workflow_id:
          type: string
          title: Workflow Id
        workflow_version_id:
          type: string
          title: Workflow Version Id
        trigger:
          $ref: '#/components/schemas/TriggerInfo'
        lifecycle:
          oneOf:
            - $ref: '#/components/schemas/PendingWorkflowTestRun'
            - $ref: '#/components/schemas/QueuedWorkflowTestRun'
            - $ref: '#/components/schemas/RunningWorkflowTestRun'
            - $ref: '#/components/schemas/CompletedWorkflowTestRun'
            - $ref: '#/components/schemas/ErrorWorkflowTestRun'
            - $ref: '#/components/schemas/CancelledWorkflowTestRun'
          title: Lifecycle
          discriminator:
            propertyName: status
            mapping:
              cancelled:
                $ref: '#/components/schemas/CancelledWorkflowTestRun'
              completed:
                $ref: '#/components/schemas/CompletedWorkflowTestRun'
              error:
                $ref: '#/components/schemas/ErrorWorkflowTestRun'
              pending:
                $ref: '#/components/schemas/PendingWorkflowTestRun'
              queued:
                $ref: '#/components/schemas/QueuedWorkflowTestRun'
              running:
                $ref: '#/components/schemas/RunningWorkflowTestRun'
        timing:
          $ref: '#/components/schemas/WorkflowTestRunTiming'
        target:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTestBlockTarget'
            - type: 'null'
        test_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Test Id
        total_tests:
          type: integer
          title: Total Tests
        counts:
          $ref: '#/components/schemas/BlockTestBatchExecutionCounts'
          default:
            lifecycle_counts:
              cancelled: 0
              completed: 0
              error: 0
              pending: 0
              queued: 0
              running: 0
            outcome:
              blocked: 0
              failed: 0
              passed: 0
        freshness:
          $ref: '#/components/schemas/ArtifactFreshness'
      type: object
      required:
        - id
        - lifecycle
        - timing
        - total_tests
        - trigger
        - workflow_id
        - workflow_version_id
      title: WorkflowTestRun
      description: >-
        A batch execution of a workflow's tests, with overall `lifecycle`,
        `timing`, and pass/fail `counts`.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    TriggerInfo:
      properties:
        type:
          type: string
          enum:
            - manual
            - api
            - schedule
            - webhook
            - email
            - custom
            - restart
          title: Type
          description: What started this run
      type: object
      required:
        - type
      title: TriggerInfo
      description: |-
        Public summary of what started a run: just the trigger category.

        The full per-variant detail (schedule_id, parent_run_id, sender, ...) is
        kept internally on `StoredWorkflowRun.trigger` but intentionally not
        exposed in the public API surface.
    PendingWorkflowTestRun:
      properties:
        status:
          type: string
          const: pending
          title: Status
          default: pending
      type: object
      title: PendingWorkflowTestRun
      description: The test run has been created but execution has not started.
    QueuedWorkflowTestRun:
      properties:
        status:
          type: string
          const: queued
          title: Status
          default: queued
      type: object
      title: QueuedWorkflowTestRun
      description: The test run is enqueued and waiting for a worker.
    RunningWorkflowTestRun:
      properties:
        status:
          type: string
          const: running
          title: Status
          default: running
      type: object
      title: RunningWorkflowTestRun
      description: The test run is executing assertions.
    CompletedWorkflowTestRun:
      properties:
        status:
          type: string
          const: completed
          title: Status
          default: completed
      type: object
      title: CompletedWorkflowTestRun
      description: The test run finished. Per-test verdicts live on each result row.
    ErrorWorkflowTestRun:
      properties:
        status:
          type: string
          const: error
          title: Status
          default: error
        message:
          type: string
          title: Message
          description: Human-readable error message
          default: (no message)
        details:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetails'
            - type: 'null'
          description: Structured error context including stack trace
      type: object
      title: ErrorWorkflowTestRun
      description: |-
        The test run failed. The error message lives on this variant.

        Carries the same structured `details` envelope as workflow runs so
        consumers can branch on `error_code` / `stage` rather than parsing
        a free-text message.
    CancelledWorkflowTestRun:
      properties:
        status:
          type: string
          const: cancelled
          title: Status
          default: cancelled
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
          description: Human-readable reason, when known
      type: object
      title: CancelledWorkflowTestRun
      description: The test run was cancelled before reaching a natural terminal state.
    WorkflowTestRunTiming:
      properties:
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the workflow-test run was created.
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
      type: object
      title: WorkflowTestRunTiming
    WorkflowTestBlockTarget:
      properties:
        type:
          type: string
          const: block
          title: Type
          default: block
        block_id:
          type: string
          title: Block Id
      type: object
      required:
        - block_id
      title: WorkflowTestBlockTarget
      description: >-
        Public workflow-test target.


        The storage layer remains block-scoped today, but the API shape names
        the

        tested entity explicitly so workflow-level targets can be added later.
    BlockTestBatchExecutionCounts:
      properties:
        lifecycle_counts:
          $ref: '#/components/schemas/BlockTestLifecycleCounts'
          default:
            pending: 0
            queued: 0
            running: 0
            completed: 0
            error: 0
            cancelled: 0
        outcome:
          $ref: '#/components/schemas/BlockTestOutcomeCounts'
          default:
            passed: 0
            failed: 0
            blocked: 0
      type: object
      title: BlockTestBatchExecutionCounts
      description: |-
        Aggregate counts for a batch of block-test runs.

        Each individual run contributes to exactly one `lifecycle_counts`
        bucket, and additionally to one `outcome` bucket when
        `lifecycle_counts.completed` is incremented.
    ArtifactFreshness:
      properties:
        status:
          type: string
          enum:
            - fresh
            - stale
            - unknown
          title: Status
          default: unknown
        reasons:
          items:
            type: string
            enum:
              - validity_changed
              - inputs_changed
              - engine_changed
              - metrics_engine_changed
              - no_baseline
          type: array
          title: Reasons
          default: []
        validity_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Validity Fingerprint
        input_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          title: Input Fingerprint
        baseline_run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Baseline Run Id
      type: object
      title: ArtifactFreshness
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorDetails:
      properties:
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: >-
            Human-readable error message. Free-text; the structured fields below
            are the machine-readable counterpart.
        stack_trace:
          anyOf:
            - type: string
            - type: 'null'
          title: Stack Trace
          description: Full stack trace
        block_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Block Id
          description: ID of the block that failed
        block_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Block Name
          description: Name/label of the block that failed
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
          description: Error code if available
        context:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Context
          description: Additional context about the error
      type: object
      title: ErrorDetails
      description: |-
        Detailed error information for debugging.

        Captures stack traces and context about where and why an error occurred.
    BlockTestLifecycleCounts:
      properties:
        pending:
          type: integer
          title: Pending
          default: 0
        queued:
          type: integer
          title: Queued
          default: 0
        running:
          type: integer
          title: Running
          default: 0
        completed:
          type: integer
          title: Completed
          default: 0
        error:
          type: integer
          title: Error
          default: 0
        cancelled:
          type: integer
          title: Cancelled
          default: 0
      type: object
      title: BlockTestLifecycleCounts
      description: Per-lifecycle counts for a batch of block-test runs.
    BlockTestOutcomeCounts:
      properties:
        passed:
          type: integer
          title: Passed
          default: 0
        failed:
          type: integer
          title: Failed
          default: 0
        blocked:
          type: integer
          title: Blocked
          default: 0
      type: object
      title: BlockTestOutcomeCounts
      description: Per-outcome counts. Only completed runs contribute to these buckets.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````