# Have your Agents run your app's tests

> Ask an Agent to run your app's tests, follow the run in the chat, read the result and ask for a fix.

Source: https://air.build/docs/build/run-your-apps-tests/

Your Agents can run the automated tests in your project and tell you what passed and what failed. You ask in the project's chat. The Agent runs the tests with the `runtest` command (see [runtest](https://air.build/docs/cli/runtest/)) and reports back in the chat.

Where the tests run depends on your Team:

| Team | Where the tests run |
| --- | --- |
| Cloud Team | On a Mac builder in the cloud. Tests of the Android version (beta) run on a Linux builder. Other scripts an Agent runs on a Linux builder use [runlinux](https://air.build/docs/cli/runlinux/). |
| Team on your Mac | On that Mac. |

A test run doesn't use your Preview devices, so you won't see it in Preview. To watch an Agent go through your app on a device instead, ask it to try the app in Preview. See [Run your app in Preview](https://air.build/docs/build/preview-your-app/).

## Ask for a test run

In the project's chat, ask for the tests, for example:

```text
Run the app's tests and tell me what fails.
```

To run only some of them, say which, for example "Run only the sign-in tests."

A project's tests are listed under `test:` in its `airbuild.yaml` file, each under a name. If there are none yet, ask the Agent to write some first, then run them:

```text
Add tests for sign-in and checkout, then run them.
```

## Follow the run

While the tests run, the row above the message box shows what the Agent says it's doing. See [Work with your Agents in chat](https://air.build/docs/projects/work-with-agents-in-chat/#see-what-agents-are-doing). If the run is part of a task, the task's card shows the same. See [Follow your Agents' work with tasks](https://air.build/docs/projects/track-work-with-tasks/).

With **Show What Agents Are Doing**, an experimental feature, the Team's owner can also watch the Agent's tools and output as they happen. See [Watch what an Agent is doing](https://air.build/docs/agents/watch-agents-work/).

A run keeps going until it's done, even if the Agent is interrupted, and the Agent can pick it up again. To stop it, ask:

```text
Cancel the test run.
```

## Read the result

The Agent tells you in the chat whether the tests passed. The test command doesn't post a card by itself, but the Agent may send a report card that lists what failed. If you want one, ask for it. See [Read a chart or a check report an Agent sends](https://air.build/docs/agents/read-charts-and-checks-from-agents/#read-a-report).

## Ask for a fix

Reply in the chat, for example:

```text
Fix the two failing tests and run them again.
```

A failing test can mean the app is wrong or the test is. If you're not sure which, ask the Agent before it changes either:

```text
Is the app wrong, or is the test out of date?
```

After a change, the Agent starts a new run. When it builds the app again, you can check the fix in Preview. See [Open the Preview when a new build is ready](https://air.build/docs/build/open-the-preview-when-a-build-is-ready/).

## Other ways to test

| What | Where to look |
| --- | --- |
| Tests of your app's Android version (beta) | Ask for them the same way, for example "Run the Android tests." See [Make an Android or PocketJS version (beta)](https://air.build/docs/build/android-and-pocketjs/). |
| Xcode Cloud workflows with a **Test** action | The project's **Xcode Cloud** tab shows each run's test failures. See [Build with Xcode Cloud](https://air.build/docs/app-store/build-with-xcode-cloud/). |
| People trying a beta | See [Share a beta with TestFlight](https://air.build/docs/app-store/test-with-testflight/). |

## Questions

**Can several test runs go at once?**

In a cloud Team, yes. A Team on your Mac runs one at a time.
