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

# Run data tests

> Execute existing data tests for a project

Use this endpoint to run [data tests](/data-analysis/development/tests/test-comparison).

Column tests, table tests, and project tests can be run together in a single API call. Model tests must be run in a separate API call and cannot be mixed with other test types.

## Requirements

To run data tests for a project using the API, you need to:

* Publish the project to a [Prophecy fabric](/data-analysis/environment/fabrics/prophecy-fabrics).
* Set up data tests in the Prophecy [Studio](/data-analysis/development/studio/studio). This includes both creating tests and assigning them to tables or models.
* Ensure that any tables you want to test have data. You'll have to run your pipelines once to populate target tables.


## OpenAPI

````yaml post /api/orchestration/tests/run
openapi: 3.0.3
info:
  title: Prophecy API - Pipeline Runs
  description: API for triggering and monitoring pipeline runs
  version: 1.0.0
servers: []
security: []
paths:
  /api/orchestration/tests/run:
    parameters:
      - name: X-AUTH-TOKEN
        in: header
        description: Prophecy orchestration authentication token
        required: true
        schema:
          type: string
    post:
      tags:
        - Pipeline Runs
      summary: Run data tests
      description: Execute existing data tests for a project
      operationId: runDataTests
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - fabricId
                    - projectId
                  properties:
                    fabricId:
                      type: integer
                      format: int64
                      description: >-
                        Unique identifier of the data fabric where the project
                        resides. You can find the ID in the URL of the fabric
                        metadata page.
                    projectId:
                      type: string
                      description: >-
                        Unique identifier of the project. You can find this
                        string in the URL of the project editor or metadata
                        page.
                    branch:
                      type: string
                      description: >-
                        Specific branch of the project to use. If omitted, the
                        API uses the current working branch — typically the
                        `dev` branch for projects using the Simple Git Storage
                        Model.
                    version:
                      type: string
                      description: >-
                        Specific version of the project. If omitted, the API
                        uses the latest published version of the project.
                    tests:
                      type: array
                      description: >-
                        Array of test configurations. Can include column tests,
                        table tests, and project tests together. Model tests
                        cannot be included here.
                      items:
                        type: object
                        properties:
                          source:
                            type: string
                            description: >-
                              Source name from `/prophecy-sources/sources.yml`
                              file in the project code repository. 


                              **Required when running column tests or table
                              tests.** Must be used together with `table`.
                          table:
                            type: string
                            description: >-
                              Table name from `/prophecy-sources/sources.yml`
                              file in the project code repository. 


                              **Required when running column tests or table
                              tests.** Must be used together with `source`.
                          columnTests:
                            type: array
                            description: Array of column-level test configurations.
                            items:
                              type: object
                              required:
                                - name
                                - tests
                              properties:
                                name:
                                  type: string
                                  description: Name of the column to test.
                                tests:
                                  type: array
                                  description: >-
                                    Array of test definitions for this column.
                                    Each test must be a separate object with a
                                    `name` field.
                                  items:
                                    type: object
                                    required:
                                      - name
                                    properties:
                                      name:
                                        type: string
                                        description: Name of the test to execute.
                          tableTests:
                            type: array
                            description: Array of table-level test configurations.
                            items:
                              type: object
                              required:
                                - name
                              properties:
                                name:
                                  type: string
                                  description: Name of the test to execute.
                          projectTests:
                            type: array
                            description: Array of project-level test configurations.
                            items:
                              type: object
                              required:
                                - name
                              properties:
                                name:
                                  type: string
                                  description: Name of the project test to execute.
                - type: object
                  required:
                    - fabricId
                    - projectId
                    - modelName
                  properties:
                    fabricId:
                      type: integer
                      format: int64
                      description: >-
                        Unique identifier of the data fabric where the project
                        resides. You can find the ID in the URL of the fabric
                        metadata page.
                    projectId:
                      type: string
                      description: >-
                        Unique identifier of the project. You can find this
                        string in the URL of the project editor or metadata
                        page.
                    modelName:
                      type: string
                      description: >-
                        Name of the model to test. The API will run **all
                        tests** for the specified model. 


                        Model tests must be run in a separate API call and
                        cannot be mixed with column tests, table tests, or
                        project tests.
                    branch:
                      type: string
                      description: >-
                        Specific branch of the project to use. If omitted, the
                        API uses the currently checked out working branch.
                    version:
                      type: string
                      description: >-
                        Specific version of the project. If omitted, the API
                        uses the latest published version of the project.
                    tests:
                      type: array
                      description: Array containing a single empty object for model tests.
                      items:
                        type: object
            examples:
              combinedTests:
                summary: >-
                  Request to run column tests, table tests, and project tests
                  together
                value:
                  fabricId: 4251
                  projectId: '2419'
                  tests:
                    - source: hospital_patients
                      table: patient_details
                      columnTests:
                        - name: age
                          tests:
                            - name: not_null
                        - name: id
                          tests:
                            - name: not_null
                            - name: unique
                      tableTests:
                        - name: equal_row_count
                    - projectTests:
                        - name: assert_table_not_empty
              modelTests:
                summary: Request to run model tests
                value:
                  fabricId: 4251
                  projectId: '2419'
                  branch: update_patient_details
                  modelName: patient_transformed_details
                  tests:
                    - {}
      responses:
        '200':
          description: Test execution completed
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    description: Indicates whether the API request was successful.
                  data:
                    type: object
                    required:
                      - results
                      - summary
                      - dbtStdout
                    properties:
                      results:
                        type: array
                        description: Array of test execution results.
                        items:
                          type: object
                          required:
                            - name
                            - status
                            - table
                            - columnName
                            - index
                            - time
                            - cause
                          properties:
                            name:
                              type: string
                              description: Name of the test that was executed.
                            status:
                              type: string
                              enum:
                                - SUCCEEDED
                                - FAILED
                                - ERROR
                              description: Result of the test.
                            table:
                              type: string
                              description: Table name associated with this test result.
                            columnName:
                              type: string
                              description: >-
                                Column name associated with this test result.
                                Empty string for table-level and project-level
                                tests.
                            index:
                              type: integer
                              description: Index of the test result in the execution order.
                            time:
                              type: number
                              format: float
                              description: Time taken to execute the test in seconds.
                            cause:
                              type: string
                              description: >-
                                Error message or failure cause if the test
                                failed or errored. Empty string if the test
                                succeeded.
                      dbtStdout:
                        type: string
                        description: Standard output from dbt test execution.
                      summary:
                        type: object
                        required:
                          - failed
                          - skip
                          - succeeded
                          - total
                          - warning
                        properties:
                          failed:
                            type: integer
                            description: Number of tests that failed.
                          skip:
                            type: integer
                            description: Number of tests that were skipped.
                          succeeded:
                            type: integer
                            description: Number of tests that succeeded.
                          total:
                            type: integer
                            description: Total number of tests executed.
                          warning:
                            type: integer
                            description: Number of tests that produced warnings.
              examples:
                combinedTests:
                  summary: >-
                    Response from running column tests, table tests, and project
                    tests
                  value:
                    success: true
                    data:
                      results:
                        - name: equal_row_count
                          status: FAILED
                          table: patient_details
                          columnName: ''
                          index: 0
                          time: 3.55
                          cause: >-
                            14:21:36  Failure in test
                            source_tbt_test_tanmay_piyush_test_dbt_test_1_
                            (prophecy-sources/sources.yml)

                            14:21:36    Got 1 result, configured to fail if != 0

                            14:21:36
                        - name: unique
                          status: SUCCEEDED
                          table: patient_details
                          columnName: id
                          index: 0
                          time: 0.81
                          cause: ''
                        - name: not_null
                          status: SUCCEEDED
                          table: patient_details
                          columnName: age
                          index: 0
                          time: 4.14
                          cause: ''
                        - name: not_null
                          status: SUCCEEDED
                          table: patient_details
                          columnName: id
                          index: 0
                          time: 0.64
                          cause: ''
                        - name: assert_table_not_empty
                          status: SUCCEEDED
                          table: ''
                          columnName: ''
                          index: 0
                          time: 0.69
                          cause: ''
                      dbtStdout: <long-output-from-dbt-test-execution>
                      summary:
                        failed: 1
                        skip: 0
                        succeeded: 4
                        total: 5
                        warning: 0
                modelTests:
                  summary: Response from running model tests
                  value:
                    success: true
                    data:
                      results:
                        - name: not_null
                          status: SUCCEEDED
                          table: patient_transformed_details
                          columnName: name
                          index: 0
                          time: 0.72
                          cause: ''
                        - name: equal_row_count
                          status: ERROR
                          table: patient_transformed_details
                          columnName: ''
                          index: 0
                          time: 0.73
                          cause: >-
                            14:29:25  Failure in test
                            equal_row_count_patient_transformed_details_
                            (models/schema.yml)

                            14:29:25    Database Error in test
                            equal_row_count_patient_transformed_details_
                            (models/schema.yml)
                              [UNRESOLVED_COLUMN.WITH_SUGGESTION] A column, variable, or function parameter with name `country` cannot be resolved. Did you mean one of the following? [`age`, `city`, `name`, `id`]. SQLSTATE: 42703; line 11 pos 44
                        - name: unique
                          status: SUCCEEDED
                          table: patient_transformed_details
                          columnName: name
                          index: 0
                          time: 0.67
                          cause: ''
                      dbtStdout: <long-output-from-dbt-test-execution>
                      summary:
                        failed: 1
                        skip: 0
                        succeeded: 2
                        total: 3
                        warning: 0

````