# Auto Testing using UI

## **Add test data to the Policy**

Tests can be added to the Policy, when such a policy gets published then the added tests get embedded into the policy file.

Such tests are imported/exported together with their respective policies.

{% hint style="info" %}
**Note:** Tests can be run only when the policy is in the dry-run or demo status.
{% endhint %}

### 1. Adding Tests

Tests can be added to the policy via the corresponding menu option as shown on the screenshots below:

<figure><img src="/files/IUgrd8Jo8uSZp6I3X4S0" alt=""><figcaption></figcaption></figure>

![](/files/tuZzntTv3pQ7aNjdfeJJ)

### 2. Running Tests

To launch a test navigate to the tests list using the ‘Test details’ menu option\\

<figure><img src="/files/MCaq4lhNZSFgQJPxnWgk" alt=""><figcaption></figcaption></figure>

\
Select the desired test in the grid and press ***Run (or Re-Run)***

![](/files/Km61Ytzs2dwtYpxznXUv)

{% hint style="info" %}
**Note:** There could be only one active (running) test per policy, multiple policies can be running tests at the same time.
{% endhint %}

<figure><img src="/files/2z5iA6QLexl2OVAQsBc9" alt=""><figcaption></figcaption></figure>

### 3. View Test Results

Test results can be viewed in the test window

<figure><img src="/files/cyz1kdWrnNLDzIngabCm" alt=""><figcaption></figcaption></figure>

There are potential outcomes of running policy tests

1. **Stopped** – test was stopped by the user
2. **Success** – test was successfully executed and the results are fully matching those originally captured

![](/files/cUMXJwrijnAYklPRICLR)

3. **Failure (1)** – an error has occurred during the run of the test, the execution of the test was not completed

![](/files/wJEyrRVRFNYIBnObYk7j)

4. **Failure (2)** – test was executed, however test results (i.e. the produced artifacts) differ from those originally captured

![](/files/bpKFCl3whOdIx66iC5se)

Detailed comparison of the execution results (documents) can be performed by clicking on the ‘Show more details’ button.

![](/files/CxPXZsRM9JdRxcKpyZZu)

![](/files/MUCVzjJkQmSWPMqLuaC2)

### 4. Removing Tests

Tests which are not being run can be deleted.

![](/files/FDedGbyoeQEsjyVSLyHt)

### 5. Access from the grid

Tests can be managed and run from the Manage Policies grid.

<figure><img src="/files/1lDe2rjqaj4hTdLJEKQh" alt=""><figcaption></figcaption></figure>

This view allows to:

* Add a test to the policies if it does not yet have any tests
* Run the most recently added test
* Re-run the most recently run test
* Monitor the status of the test being run

## 2. Demo Mode

To simplify the UI of policy testing (useful for novice users) a new ‘**Demo**’ mode of policy import has been introduced. In this mode all policy processing is ‘read-only’, policy editing is not possible, and no communication with external systems such as Hedera network and/or IPFS is performed. Policy execution in the **Demo** mode is similar to **dry-run**.

To use demo mode the corresponding option should be selected on the policy import dialogue.

<figure><img src="/files/4hTMrkgwDsffHzcg5ciE" alt=""><figcaption></figcaption></figure>


---

# 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://guardian.hedera.com/guardian-dev/guardian/standard-registry/policies/auto-testing-of-the-policies/auto-testing-using-ui.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.
