> For the complete documentation index, see [llms.txt](https://docs.appmixer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmixer.com/connector-configuration/utils/test/assert.md).

# Assert

### Overview

The **Assert Component** provides a set of assertion functions for verifying the correctness of component outputs in a test workflow. It checks whether expected conditions are met and outputs success or failure messages accordingly.

### Usage

This component is used to validate component outputs based on defined assertions such as equality checks, presence of values, and regular expression matching.

#### Input Ports

| Port | Description                                         |
| ---- | --------------------------------------------------- |
| `in` | Receives an object containing assertions to verify. |

#### Output Ports

| Port  | Description                                                        |
| ----- | ------------------------------------------------------------------ |
| `out` | Sends the assertion results, including success and error messages. |

#### Properties

| Property     | Type     | Description                                                            |
| ------------ | -------- | ---------------------------------------------------------------------- |
| `expression` | `object` | Defines the assertion logic, including conditions and expected values. |

#### Supported Assertions

| Assertion Type | Description                                                                    |
| -------------- | ------------------------------------------------------------------------------ |
| `equal`        | Checks if a field is equal to an expected value.                               |
| `notEmpty`     | Ensures a field is not empty.                                                  |
| `regex`        | Validates if a field matches a specified regular expression.                   |
| `type`         | Checks if a field is of a specific type (e.g., number, string, array, object). |

#### Processing Logic

1. **Receives Assertions**: Accepts an object defining assertions to be applied.
2. **Validates Conditions**: Runs checks based on assertion type (equality, regex, non-empty values, etc.).
3. **Generates Results**: Produces a success message for each passed assertion and an error message for failures.
4. **Sends Output**: Outputs results as a JSON object with success and error details.

### Notes

* **Multiple Assertions**: Supports multiple assertion checks within a single execution.
* **Flexible Validation**: Works with various data types and assertion conditions.
* **Test Automation**: Useful for validating component outputs in automated testing workflows.

This component is ideal for ensuring data correctness and validating expected behavior in test workflows.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appmixer.com/connector-configuration/utils/test/assert.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
