> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tela.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a test case

> Executes one test case against a prompt version. A generation is created in `initializing` status before the background job starts, so the returned `generationId` can be polled or aborted immediately.



## OpenAPI

````yaml POST /test-case/{id}/run
openapi: 3.0.1
info:
  title: Tela API
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tela.com
security: []
paths:
  /test-case/{id}/run:
    post:
      tags:
        - Test Case
      summary: Run a test case
      description: >
        Executes one test case against a prompt version. A generation is created
        in `initializing` status before the

        background job starts, so the returned `generationId` can be polled or
        aborted immediately.


        If a generation for the same test case and version is still in progress
        the call returns `200` with

        `success: false` instead of starting another one. Workflow versions must
        be consolidated (not `draft`) to

        run. Counts towards the workspace inference quota.
      parameters:
        - name: id
          in: path
          required: true
          description: Test case id.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestCaseRunRequest'
      responses:
        '200':
          description: Execution started, or refused because one is already running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestCaseRunResponse'
        '400':
          description: The version is a workflow draft and must be consolidated first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing or invalid credentials, or no access to the test case.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Workspace inference quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Test case or prompt version not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    TestCaseRunRequest:
      type: object
      properties:
        promptVersionId:
          type: string
          format: uuid
          description: Version to run the test case against.
      required:
        - promptVersionId
    TestCaseRunResponse:
      oneOf:
        - $ref: '#/components/schemas/TestCaseRunStartedResponse'
        - $ref: '#/components/schemas/TestCaseRunRefusedResponse'
      example:
        executionId: run_01J9Z8Q4M6N2P8R1S3T5V7W9X
        testCaseIds:
          - 2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d
        generationId: 6f7a8b9c-0d1e-4f2a-8b3c-4d5e6f7a8b9c
    Error: {}
    TestCaseRunStartedResponse:
      type: object
      properties:
        executionId:
          type: string
          description: Background job id.
        testCaseIds:
          type: array
          items:
            type: string
            format: uuid
        generationId:
          type: string
          format: uuid
          description: >-
            Id of the generation created for this run; use it to poll status or
            read the result.
      required:
        - executionId
        - testCaseIds
        - generationId
      example:
        executionId: run_01J9Z8Q4M6N2P8R1S3T5V7W9X
        testCaseIds:
          - 2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d
        generationId: 6f7a8b9c-0d1e-4f2a-8b3c-4d5e6f7a8b9c
    TestCaseRunRefusedResponse:
      type: object
      description: >-
        Returned with HTTP 200 when a generation for the same test case and
        version is already in progress.
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
      required:
        - success
        - message
      example:
        success: false
        message: There is already a generation running for this prompt version
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or UUID

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.