---
title: "Test a condition"
slug: "test-a-condition"
abstract: "Explains how to test a condition."
---
# Test a condition

Sitecore CDP enables you to test a condition by running it against a selected guest.

We recommend testing the condition before you publish it, to identify any errors and ensure optimal performance. After changing the code, re-test the condition with the same guest to check the results.

For more advanced use cases that require passing in headers and parameters in the request, you can [test an advanced condition](https://doc.sitecore.com/cdp/en/users/sitecore-cdp/developer-center/conditions/test-a-condition/test-an-advanced-condition.html "Test an advanced condition").

When you test a condition, Sitecore CDP tests the JavaScript on the server-side. This ensures that the JavaScript is validated within the context it will be executed in.

> [!note]
> Team members with a *User*, *Developer*, or *Admin* role in Sitecore Cloud Portal can test a condition.

To test a condition:

1. Open the condition and click **Test**.

    ![Testing a condition](https://doc.sitecore.com/api/markdown-image/cdp/en/users/sitecore-cdp/images/pers_testcond.png)

2. In the **Test Condition** dialog, you can test against the default guest's attributes, or click in the search box and choose **Recent** to select from a list of recently active guests or **Bookmarks** to select from a list of bookmarked guests. To select a specific guest, enter their unique identifier into the search box. You can search for a guest using, for example, an email address, other unique identifier, or browser ID.

    > [!note]
    > If there is a guest whose data you often use when configuring or testing code, just click the **star** icon to bookmark the guest so you no longer have to search for them.

3. To temporarily modify the guest data (this is only temporary and does not change any attributes associated with the guest), edit the JSON in the code editor.
4. To configure the guest parameters and view them in the response of the test, you must include this JavaScript in the code editor to call the `guest` context:

    ```csharp
    (function () {
            return { guest: guest };
    })();
    ```

5. Click the **Condition parameters** option to enter values and click **Test**. The guest parameters is included in the response.
6. To include the **Point of Sale** parameter and view it in the response of the test, you must include this JavaScript in the code editor to call the `request` context.

    ```csharp
    (function () {
            return { request: request };
    })();
    ```

7. Click the **Experience request** option and select the point of sale and click **Test**. The `pointOfSale` parameter is included in the response.
8. To include the `tenant` parameters and view them in the response of the test, you must include this JavaScript in the code editor to call the `tenant` context, as shown here:

    ```csharp
    (function () {
            return { tenant: tenant };
    })();
    ```

9. Click the **Condition parameters** option to enter values and click **Test**. The tenant parameters are included in the response.