> For the complete documentation index, see [llms.txt](https://docs.lleverage.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lleverage.ai/publishing-guide/tests.md).

# Tests

Build reliable workflows by creating automated tests that validate your outputs against specific criteria. Tests help ensure your workflows perform consistently across different inputs and edge cases.

### Overview

Tests validate workflow outputs automatically by checking them against a list of criteria you define. When you create a test, Lleverage saves the inputs from your run as a fixture and can replay them to check whether your workflow still meets your requirements after making changes.

Key features:

* Automatic input capture from workflow runs
* Plain-language criteria, checked individually
* Passed / Failed results with a confidence indicator
* An AI evaluation model of your choice judges the output
* Tests can be generated from end-user feedback
* Run your whole test suite in one go

### How to Access Tests

1. Open the run panel from the top right corner of the canvas
2. Select the **Test** tab
3. Your test suite appears, with options to create your first test if none exist yet

### How to Create a Test from a Run

1. After running your workflow, click **Create Test** on the run output
2. The test creation form appears pre-filled with your run data
3. **Choose the variable to evaluate**: pick which workflow output the test should check
4. **Write your criteria**: add one or more plain-language statements that should be true about the output, for example "The extracted text contains a person's name". Each criterion can be edited, added, or removed individually.
5. **Pick an evaluation model**: choose which AI model judges whether the output meets your criteria
6. Save the test to add it to your suite, or save and run it straight away

> 💡 **Tip**: Tests automatically capture and store the inputs from your original run as a fixture, so you can replay the exact same scenario as often as you like.

### How to Create Tests from Feedback

1. Open the **Feedback** tab in the run panel
2. Find a piece of end-user feedback worth turning into a regression check
3. Click **Create Test** on the feedback item
4. The test is set up from that session's inputs, ready for you to refine the criteria

> 💡 Feedback-driven tests are a quick way to make sure a problem an end user hit never comes back.

### Understanding Test Results

* **Passed**: the output met your criteria
* **Failed**: one or more criteria were not met
* **Confidence indicator**: alongside the result, a Low, Medium, or High confidence label shows how certain the evaluation was. Low confidence usually means the criteria are ambiguous or the output was unclear, so consider tightening the wording.
* **Per-criterion detail**: each criterion is judged individually, so you can see exactly which ones passed or failed
* **View the session**: open the session behind a test result to inspect the full run that produced the output

### How to Work with Fixtures

A test's fixture is the saved set of inputs it replays.

1. Open a test and edit its fixture to change the inputs it runs with
2. Preview the fixture to check what the test will actually send before running it
3. To test a different scenario, duplicate the test and give the copy its own fixture

### How to Manage Existing Tests

**To run a test again:**

1. Select the test you want to re-run
2. Click **Run** to execute it with its stored fixture
3. Compare results to see if your workflow changes improved things

**To run all tests:**

1. Use the run all option at the top of your test suite
2. Every test executes against the current workflow
3. Review the pass and fail counts to spot regressions

**To edit a test:**

1. Select the test you want to modify
2. Update the criteria, the variable being evaluated, the evaluation model, or the fixture
3. Save your changes

**To delete a test:**

1. Select the test you want to remove
2. Click **Delete** and confirm

### How to Build Comprehensive Test Suites

1. **Test different input types**: Create tests for the various data formats your workflow might receive
2. **Test edge cases**: Include unusual or extreme inputs that might break your workflow
3. **Test business logic**: Validate that your workflow handles different business scenarios correctly
4. **Run all tests together**: Execute your entire suite after making changes to catch regressions early

> 💡 **Best Practice**: For complex business processes, create multiple tests with different fixtures to ensure your workflow handles all possible scenarios reliably.

Tests are essential for maintaining workflow reliability, especially when making changes or handling complex business processes with varied input types.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.lleverage.ai/publishing-guide/tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
