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

# Generate test automation

> Write the automation code for a test that has a description but no working test file yet. Explores the app on a device, writes the test, verifies it by running it several times in a row, and commits it to the organisation's test repository, after which the test is runnable via `POST /tests/execute`. By default this targets the newest build uploaded for every platform the organisation has one for; pass `uploadId`, `bundleId`, or `platform` to narrow that. Generation is fire-and-forget: it queues on the organisation's existing device slots and the response returns as soon as the work is dispatched, not once it finishes.



## OpenAPI

````yaml /openapi.json post /tests/generate
openapi: 3.0.2
info:
  title: MobileBoost API
  version: 1.0.0
servers:
  - url: https://api.mobileboost.io
security:
  - BearerAuth: []
paths:
  /tests/generate:
    post:
      summary: Generate test automation
      description: >-
        Write the automation code for a test that has a description but no
        working test file yet. Explores the app on a device, writes the test,
        verifies it by running it several times in a row, and commits it to the
        organisation's test repository, after which the test is runnable via
        `POST /tests/execute`. By default this targets the newest build uploaded
        for every platform the organisation has one for; pass `uploadId`,
        `bundleId`, or `platform` to narrow that. Generation is fire-and-forget:
        it queues on the organisation's existing device slots and the response
        returns as soon as the work is dispatched, not once it finishes.
      operationId: generate_tests
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateTests'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  started:
                    type: array
                    description: >-
                      The generation run that was dispatched immediately, for
                      the first platform.
                    items:
                      type: object
                  queued:
                    type: array
                    description: >-
                      Platforms queued to start once the first platform's
                      generation finishes (only present when a test needs
                      automation on more than one platform).
                    items:
                      type: string
              example:
                started:
                  - runId: b1111111df174791a93e560390ea7e65
                queued:
                  - ios
        '400':
          description: >-
            No build has been uploaded for this organisation (and no `bundleId`
            was given), so there is nothing to write the automation against.
components:
  schemas:
    GenerateTests:
      title: GenerateTests
      required:
        - organisationId
        - testIds
      type: object
      properties:
        organisationId:
          title: Organisation ID
          type: string
          description: Your MobileBoost organisation ID.
        testIds:
          title: Test IDs
          type: array
          items:
            type: string
          description: >-
            IDs of existing test cases to write automation for. Each test must
            already have a description, since generation writes code for the
            described behaviour rather than inventing one.
        uploadId:
          title: Upload ID
          type: string
          description: >-
            Write the automation against a specific uploaded build instead of
            the organisation's newest one.
        bundleId:
          title: Bundle ID
          type: string
          description: >-
            Write the automation against the app already installed on your
            reserved device, instead of an uploaded build. May omit `platform`,
            which is then taken from the reserved device.
        platform:
          title: Platform
          type: string
          description: >-
            Restrict generation to one platform (`ios` or `android`). Taken from
            the upload when omitted with `uploadId`; with neither `uploadId` nor
            `bundleId`, omitting this generates against every platform the
            organisation has a build for.
        testsRepo:
          title: Tests repo
          type: string
          description: >-
            Override the organisation's managed test repository. Normally left
            unset, since generation resolves the repo automatically and creates
            one if the organisation doesn't have one yet.
        usePhysicalDevice:
          title: Use physical device
          type: boolean
          description: >-
            Run the generation on a physical device instead of a
            simulator/emulator. Forced on automatically for iOS `.ipa` builds
            and for bundle-only (buildless) generation.
        verificationRounds:
          title: Verification rounds
          type: integer
          description: >-
            How many consecutive passing runs the generated test must produce
            before it is committed. Defaults to 3. Raising this increases
            confidence at the cost of one full test run per extra round.
        tunnelName:
          title: Tunnel name
          type: string
          description: >-
            Name of the tunnel to route the device through, for apps whose flow
            touches an internal/non-public host.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````