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

# Create test case

> Create a test case in the project. It is created in draft and a burn-in run starts automatically against the application's default environment, or against `environment` when given (e.g. a preview deployment or remote tunnel URL).

IMPORTANT: gather context first, or the test will be flaky. This tool records the test exactly as you describe it. It does NOT explore the site to confirm the flow exists, so a vague or unverified goal produces low-value, flaky tests. Before calling, make sure you have:
- Verified the functionality, pages, and UI labels actually exist in the target environment. Do not guess or assume.
- A `goal` describing a single concrete user flow in plain UI terms, using generic data rather than specific entity names. Specific entities change over time and cause flakiness.
- An `expectedResult` stating a UI-observable outcome a user can see on screen.
- Prerequisites in place: a login/auth dependency via `resumeFromDependencyProjectTestCaseId` when the flow needs authentication, plus the right `configShortIds`.
- Checked existing tests with `list_test_cases` to avoid duplicates.

If you have not gathered this context, prefer `create_chat` instead. The QA.tech chat agent crawls the site, grounds the test in what actually exists, sets up login and config dependencies, and verifies the test runs. That is how reliable tests get created. Use this tool directly only when you already know the flow exists and have the details above.



## OpenAPI

````yaml /api-reference/api.json post /v1/test-cases
openapi: 3.0.0
info:
  title: QA.tech API
  version: 1.0.0
  contact:
    name: QA.tech
    url: https://qa.tech
    email: support@qa.tech
  description: API for triggering and managing AI-powered test runs
servers:
  - url: https://api.qa.tech
    description: Production
    variables: {}
security:
  - BearerAuth: []
tags:
  - name: Runs
  - name: Infrastructure
  - name: Test Cases
  - name: Application Builds
  - name: Status badge
  - name: Remote Tunnels
  - name: Chat
  - name: Applications
  - name: Features
  - name: Metrics
  - name: Projects
  - name: Knowledge
  - name: Rules
  - name: Configs
  - name: Labels
  - name: Issues
  - name: Todos
  - name: Automations
  - name: Test plans
paths:
  /v1/test-cases:
    post:
      tags:
        - Test Cases
      summary: Create test case
      description: >-
        Create a test case in the project. It is created in draft and a burn-in
        run starts automatically against the application's default environment,
        or against `environment` when given (e.g. a preview deployment or remote
        tunnel URL).


        IMPORTANT: gather context first, or the test will be flaky. This tool
        records the test exactly as you describe it. It does NOT explore the
        site to confirm the flow exists, so a vague or unverified goal produces
        low-value, flaky tests. Before calling, make sure you have:

        - Verified the functionality, pages, and UI labels actually exist in the
        target environment. Do not guess or assume.

        - A `goal` describing a single concrete user flow in plain UI terms,
        using generic data rather than specific entity names. Specific entities
        change over time and cause flakiness.

        - An `expectedResult` stating a UI-observable outcome a user can see on
        screen.

        - Prerequisites in place: a login/auth dependency via
        `resumeFromDependencyProjectTestCaseId` when the flow needs
        authentication, plus the right `configShortIds`.

        - Checked existing tests with `list_test_cases` to avoid duplicates.


        If you have not gathered this context, prefer `create_chat` instead. The
        QA.tech chat agent crawls the site, grounds the test in what actually
        exists, sets up login and config dependencies, and verifies the test
        runs. That is how reliable tests get created. Use this tool directly
        only when you already know the flow exists and have the details above.
      operationId: CreateTestCase
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTestCaseRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTestCaseResponse'
components:
  schemas:
    CreateTestCaseRequest:
      type: object
      required:
        - name
        - goal
        - applicationShortId
      properties:
        name:
          type: string
        goal:
          type: string
          minLength: 1
        expectedResult:
          type: string
        resumeFromDependencyProjectTestCaseId:
          type: string
        waitForDependenciesProjectTestCaseIds:
          type: array
          items:
            type: string
        configShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ConfigShortId'
        applicationShortId:
          $ref: '#/components/schemas/ApplicationShortId'
        scenarioShortId:
          $ref: '#/components/schemas/ScenarioShortId'
        environment:
          allOf:
            - $ref: '#/components/schemas/ApplicationEnvironmentOverride'
          description: >-
            Environment of `applicationShortId` to run the initial burn-in
            against (e.g. a preview URL or remote tunnel URL). Omit to use the
            application's default environment. Optional customHeaders and
            basicAuth persist auth or protection-bypass rules on the
            environment.
        projectShortId:
          allOf:
            - $ref: '#/components/schemas/ProjectShortId'
          description: >-
            Target a specific project by its prefixed short ID
            (proj-slug_shortId or proj_shortId), as returned by the projects
            API. Required for organization-scoped API keys; project-scoped keys
            may only pass their own project's short ID.
      description: Request body for creating a new test case linked to a project
    CreateTestCaseResponse:
      type: object
      required:
        - success
        - testCase
      properties:
        success:
          type: boolean
        testCase:
          $ref: '#/components/schemas/TestCase'
    ConfigShortId:
      type: string
      pattern: ^cfg(-.+_.+|_.+)$
    ApplicationShortId:
      type: string
      pattern: ^app(-.+_.+|_.+)$
    ScenarioShortId:
      type: string
      pattern: ^scenario(-.+_.+|_.+)$
    ApplicationEnvironmentOverride:
      anyOf:
        - $ref: '#/components/schemas/ApplicationEnvironmentOverrideByUrl'
        - $ref: '#/components/schemas/ApplicationEnvironmentOverrideByShortId'
        - $ref: >-
            #/components/schemas/ApplicationEnvironmentOverrideByApplicationBuildShortId
    ProjectShortId:
      type: string
      pattern: ^proj(-.+_.+|_.+)$
    TestCase:
      type: object
      required:
        - id
        - name
        - url
      properties:
        id:
          type: string
        name:
          type: string
        url:
          type: string
    ApplicationEnvironmentOverrideByUrl:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          pattern: ^https?:\x2f\x2f
          description: Base URL of the environment. Must use http or https.
        name:
          type: string
        customHeaders:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentCustomHeaderRule'
          description: >-
            Custom headers for this environment. Persisted on create and on
            reuse. Omit to leave stored headers unchanged; pass an empty list to
            clear them.
        basicAuth:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentBasicAuthRule'
          description: >-
            Basic auth rules for this environment. Persisted on create and on
            reuse. Omit to leave stored rules unchanged; pass an empty list to
            clear them.
    ApplicationEnvironmentOverrideByShortId:
      type: object
      required:
        - shortId
      properties:
        shortId:
          $ref: '#/components/schemas/EnvironmentShortId'
        customHeaders:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentCustomHeaderRule'
          description: >-
            Replace custom headers on the existing environment. Omit to leave
            stored headers unchanged; pass an empty list to clear them.
        basicAuth:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentBasicAuthRule'
          description: >-
            Replace basic auth rules on the existing environment. Omit to leave
            stored rules unchanged; pass an empty list to clear them.
    ApplicationEnvironmentOverrideByApplicationBuildShortId:
      type: object
      required:
        - applicationBuildShortId
      properties:
        applicationBuildShortId:
          $ref: '#/components/schemas/ApplicationBuildShortId'
        otherApplicationBuildShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationBuildShortId'
        customHeaders:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentCustomHeaderRule'
          description: >-
            Custom headers for the preview environment created or reused for
            this build. Omit to leave stored headers unchanged; pass an empty
            list to clear them.
        basicAuth:
          type: array
          items:
            $ref: '#/components/schemas/EnvironmentBasicAuthRule'
          description: >-
            Basic auth rules for the preview environment created or reused for
            this build. Omit to leave stored rules unchanged; pass an empty list
            to clear them.
      description: >-
        Use a specific application build (created via
        `create_application_build`). Creates or reuses an environment with this
        build.
    EnvironmentCustomHeaderRule:
      type: object
      required:
        - domains
        - headers
      properties:
        domains:
          type: array
          items:
            type: string
          description: >-
            Host patterns that receive these headers. `*.preview.example.com`
            matches the apex and any subdomain.
        headers:
          type: object
          additionalProperties:
            type: string
          description: >-
            Header name to value. Applied by the platform on matching requests;
            generated test code cannot read the values.
      description: >-
        Host patterns (`*.preview.example.com` or an exact host) and the headers
        to attach to matching requests. Used for auth, deployment-protection
        bypass, and similar platform access. When provided on an environment
        override, the rules are persisted on the environment.
    EnvironmentBasicAuthRule:
      type: object
      required:
        - domains
        - username
        - password
      properties:
        domains:
          type: array
          items:
            type: string
          description: >-
            Host patterns that receive these credentials.
            `*.preview.example.com` matches the apex and any subdomain.
        username:
          type: string
          pattern: ^[^:]+$
          description: Basic auth username. May not contain `:`.
        password:
          type: string
          description: >-
            Basic auth password. Applied by the platform on matching requests;
            generated test code cannot read it.
      description: >-
        Host patterns (`*.preview.example.com` or an exact host) and the HTTP
        Basic Auth credentials to send to matching hosts. Browser, crawler, and
        API tests send `Authorization: Basic` to matching hosts only. When
        provided on an environment override, the rules are persisted on the
        environment.
    EnvironmentShortId:
      type: string
      pattern: ^env(-.+_.+|_.+)$
    ApplicationBuildShortId:
      type: string
      pattern: ^build(-.+_.+|_.+)$
  securitySchemes:
    BearerAuth:
      type: http
      scheme: Bearer

````

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