# Singular tests

Singular tests are simple SQL queries that return failing records of a model or a resource. They are typically used for one-off checks or specific business rules that do not require reusability.

You can use Jinja functions like `ref()` and `source()` to make reference to the target resource.

For example, we can create a singular test that checks for suspicious payments by method in the stg`_payments` table:

```sql
with large_payments_by_method as (
    select 
        paymentmethod,
        amount,
        status
    from {{ source("stripe", "raw_payments") }}
    where status = 'success'
        and (
            (paymentmethod = 'bank_transfer' and amount > 10000) or
            (paymentmethod = 'credit_card' and amount > 5000) or
            (paymentmethod = 'gift_card' and amount > 1000)
        )
)

select *
from large_payments_by_method
```

Notice that the singular test accepts no parameters as it's only applied on the `stg_orders` model.

## Create a singular test

To add a singular test to a model:

1. Open the **Test case template** and select / search for the **Singular Test** template.
2. Fill in the name, description, and SQL contents.

<figure><img src="/files/pRvVkbgOdWSwOQ0g8GzB" alt="" width="563"><figcaption></figcaption></figure>

3. Click **Save**.

Once added, you can verify the test by running the model in [Console](/asset-management/console.md).


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reorc.com/data-modeling/data-tests/singular-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
