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

# Adding test suites through the UI

> Create a Bundle Suite in OpenMetadata to group test cases from different tables under one alert, compare it with table test suites, and let owners manage tests.

# Add a Test Suite

Test Suites are logical containers that group related test cases from different tables, letting you set a single alert for test case failures. In the UI, this kind of test suite is called a **Bundle Suite**.

> [!NOTE]
>
> You will need to make sure you have the right permission in OpenMetadata to create a test.

1. In the left navigation bar, select **Observability** > **Data Quality**.

   ![Access data quality](https://mintcdn.com/openmetadata/R5noVNL4UN7ztTxS/public/images/features/ingestion/workflows/data-quality/access-data-quality.png?fit=max\&auto=format\&n=R5noVNL4UN7ztTxS\&q=85\&s=ab05e2bdc9017640394cd1eee7116004)

2. Click the **Test Suites** tab.

   ![Test Suites tab](https://mintcdn.com/openmetadata/R5noVNL4UN7ztTxS/public/images/features/ingestion/workflows/data-quality/test-suites-tab.png?fit=max\&auto=format\&n=R5noVNL4UN7ztTxS\&q=85\&s=a6ec1358b1be3c3783d42449bf52812d)

3. Click **Add a Bundle Suite**.

   ![Click Add a Bundle Suite](https://mintcdn.com/openmetadata/R5noVNL4UN7ztTxS/public/images/features/ingestion/workflows/data-quality/select-bundle-suite.png?fit=max\&auto=format\&n=R5noVNL4UN7ztTxS\&q=85\&s=dba5a066f15674a39c57ebef53938c45)

4. Fill in the following details:

   * Enter a unique descriptive **Name**.
   * Optional: Enter a **Description**.
   * Search and select the test cases. In OpenMetadata 2.0.3 and later, **Select All** adds only the test cases matching the active filters.

   ![Test Suite details](https://mintcdn.com/openmetadata/R5noVNL4UN7ztTxS/public/images/features/ingestion/workflows/data-quality/test-suite-details.png?fit=max\&auto=format\&n=R5noVNL4UN7ztTxS\&q=85\&s=6bed62823efd1c266bf5ce42b6b55669)

5. Click **Create**.

After creating a suite, use the search field in its details view to find a test case.

Test cases are identified by their fully qualified names, which include the table or column they test. The same short test-case name can appear under different entities.

## Table Test Suites and Bundle Suites

OpenMetadata has two kinds of test suites. They differ in how they get their owners, which matters when you set up permissions.

| | **Table test suite** | **Bundle Suite** |
| - | - | - |
| **Created** | Automatically, one for each table | By you, as described above |
| **Contains** | The test cases of one table | Test cases from any tables |
| **Owners** | Taken from the table. To change them, change the owners of the table. | Set on the suite itself. |

Because of this, the owner of a table can manage that table's test suite and test cases without extra setup, while the owner of a Bundle Suite doesn't get any rights on the tables of the test cases it contains.

### Let Owners View and Manage Their Tables' Tests

By default, `OrganizationPolicy-Owner-Rule` gives owners full access to the assets they own. For a test case, OpenMetadata checks the owners of the table that the test case belongs to. If you removed or narrowed that rule, use this recipe to let owners view and manage the tests of their own tables:

1. Go to **Settings** > **Access Control** > **Policies** and click **Add Policy**. Name it `TableOwnerDataQuality`.

2. Add a rule with these settings:

   | Setting | Value |
   | - | - |
   | **Effect** | Allow |
   | **Resources** | `TestCase`, `TestSuite` |
   | **Operations** | `ViewAll`, `EditAll`, `Create` |
   | **Condition** | `isOwner()` |

3. Add the policy to a role, and assign the role to your data owners or their team.

4. Sign in as an owner, open one of their tables, and confirm that they can view, add, and edit its test cases.

> [!NOTE]
>
> The Permission Debugger doesn't list the test case and test suite resources. To check these permissions, sign in as the user and try the action. For more information, see [Permission Debugger](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/permission-debugger.md).

## Data Quality

### Adding Data Quality Test Cases from yaml config

When creating a JSON config for a test workflow the source configuration is very simple.

```yaml theme={null}
source:
  type: TestSuite
  serviceName: <your_service_name>
  sourceConfig:
    config:
      type: TestSuite
      entityFullyQualifiedName: <entityFqn>
```

The only sections you need to modify here are the `serviceName` (this name needs to be unique) and `entityFullyQualifiedName` (the entity for which we'll be executing tests against) keys.

Once you have defined your source configuration you'll need to define te processor configuration.

```yaml theme={null}
processor:
  type: "orm-test-runner"
  config:
    forceUpdate: <false|true>
    testCases:
      - name: <testCaseName>
        testDefinitionName: columnValueLengthsToBeBetween
        columnName: <columnName>
        parameterValues:
          - name: minLength
            value: 10
          - name: maxLength
            value: 25
      - name: <testCaseName>
        testDefinitionName: tableRowCountToEqual
        parameterValues:
          - name: value
            value: 10
```

The processor type should be set to ` "orm-test-runner"`. For accepted test definition names and parameter value names refer to the [tests page](https://docs.open-metadata.org/how-to-guides/data-quality-observability/quality/tests-yaml).

> [!TIP]
>
> Note that while you can define tests directly in this YAML configuration, running the
> workflow will execute ALL THE TESTS present in the table, regardless of what you are defining in the YAML.
>
> This makes it easy for any user to contribute tests via the UI, while maintaining the test execution external.

You can keep your YAML config as simple as follows if the table already has tests.

```yaml theme={null}
processor:
  type: "orm-test-runner"
  config: {}
```

### Key reference:

* `forceUpdate`: if the test case exists (base on the test case name) for the entity, implements the strategy to follow when running the test (i.e. whether or not to update parameters)
* `testCases`: list of test cases to add to the entity referenced. Note that we will execute all the tests present in the Table.
* `name`: test case name
* `testDefinitionName`: test definition
* `columnName`: only applies to column test. The name of the column to run the test against
* `parameterValues`: parameter values of the test

The `sink` and `workflowConfig` will have the same settings as the ingestion and profiler workflow.

### Full  `yaml` config example

```yaml theme={null}
source:
  type: TestSuite
  serviceName: MyAwesomeTestSuite
  sourceConfig:
    config:
      type: TestSuite
      entityFullyQualifiedName: MySQL.default.openmetadata_db.tag_usage
#     testCases: ["run_only_this_test_case"] # Optional, if not provided all tests will be executed

processor:
  type: "orm-test-runner"
  config:
    forceUpdate: false
    testCases:
      - name: column_value_length_tagFQN
        testDefinitionName: columnValueLengthsToBeBetween
        columnName: tagFQN
        parameterValues:
          - name: minLength
            value: 10
          - name: maxLength
            value: 25
      - name: table_row_count_test
        testDefinitionName: tableRowCountToEqual
        parameterValues:
          - name: value
            value: 10

sink:
  type: metadata-rest
  config: {}
workflowConfig:
  openMetadataServerConfig:
    hostPort: <OpenMetadata host and port>
    authProvider: <OpenMetadata auth provider>
```

### How to Run Tests

To run the tests from the CLI execute the following command

```
metadata test -c /path/to/my/config.yaml
```


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