> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up CodeRabbit Verify

> Prepare an environment that starts your app, add the repository to Verify, and choose its test instructions and automatic runs.

GitHub Cloud (Verify is available on GitHub Cloud. GitHub Enterprise Server is not supported.) GitLab.com (Verify is available on GitLab.com. GitLab self-managed is not supported.) Bitbucket Cloud (Verify is available on Bitbucket Cloud. Bitbucket Data Center is not supported.) | Cloud Only (This feature is available on CodeRabbit Cloud only. It is not available on self-hosted CodeRabbit deployments.) Open Beta (Verify is in beta and free during the beta.)

Verify needs two things for each repository: an environment that can start your app, and a registration that tells Verify which environment and branch to use. You set up both in the CodeRabbit app. Verify has no organization-wide switch and no `.coderabbit.yaml` settings.

## Before you begin

* Your organization uses CodeRabbit Cloud with GitHub Cloud, GitLab.com, or Bitbucket Cloud, and **Verify** appears in the CodeRabbit app's sidebar.
* The repository is connected to CodeRabbit.
* To add the repository and change its Verify settings, you need the Coding Agent write permission, which Admins and Members have by default. See [Permissions](https://docs.coderabbit.ai/verify/access-and-billing.md#permissions).
* To create and prepare environments, you need the Admin role and an assigned Review seat or an active trial, and Coding Agent must be enabled for your organization, including data retention in the organization settings. See [Coding environments](https://docs.coderabbit.ai/code/environments.md).

## Prepare an environment

Verify runs your app from a [coding environment](https://docs.coderabbit.ai/code/environments.md), the same environments that Coding Agent and [runtime verification](https://docs.coderabbit.ai/security/runtime-verification.md) use. Create one, assign the repository to it, and prepare it until its status is **Ready**. Verify only offers an environment that is ready and prepared for the repository at its current settings, so prepare it again after you change its setup.

Verify uses the environment like this:

* **Setup runs once, at preparation.** Each run restores the environment's prepared snapshot and checks out the code under test. Verify doesn't run the setup again.
* **The startup script starts your app.** Verify uses the environment's **Startup script** for the repository to start your app before testing. The tester also gets the environment's **Startup instructions**.
* **The app runs inside the sandbox.** The startup script must start the app inside the sandbox. Put the starting URL, such as `http://localhost:3000`, in the test instructions.
* **Variables and secrets are injected.** The environment's variables and secrets are set in the environment of the startup script and the tester, so the app can read them and the tester can use them to sign in.

> [!WARNING]
>
> The tester can read the environment's variables and secrets during a run. Give the environment test accounts and non-production values only. CodeRabbit redacts these values from text evidence, but screenshots and session recordings show whatever is on screen. See [Evidence](https://docs.coderabbit.ai/verify/results.md#evidence).

### Write the startup script for Verify

Keep dependency installs and builds in the environment's setup script. Use the startup script for what each run needs: apply migrations, seed test data, and start every service the app needs, such as the database, the API, and the frontend. Before it tests, the tester reads the startup log and checks that the app responds. End the script with a readiness check, so the log shows when the app is up.

For example, with your project's own commands in place of these:

```bash theme={null}
npm run db:migrate
npm run db:seed
npm run start:api > /tmp/api.log 2>&1 &
npm run start:web > /tmp/web.log 2>&1 &
until curl -sf http://localhost:3000 > /dev/null; do sleep 2; done
```

When you open Environments from Verify, a **Return to Verify** button takes you back, and the **Add repository** form keeps your selections for 30 minutes.

## Add a repository

**1. Open the repository list**

In the CodeRabbit app, select **Verify** in the sidebar, then select **Add repository**.

**2. Choose the repository and branch**

In **Repository**, select a connected repository. A repository you've already added shows **Already added to Test suites**. In **Default branch**, keep the repository default or choose the branch that user journey runs should test.

**3. Choose the environment**

In **Environment**, select a ready environment that is prepared for this repository. If none is listed, select **Manage environments** to prepare one, then **Refresh environments**.

**4. Add it**

Select **Add repository**. The repository's page opens.

A repository can be added once per organization. Its settings apply to every Verify run on it.

## Repository settings

A repository's Verify settings are on two pages:

* **Test suite settings**: on the repository's page, select **Journey Testing** > **Settings**.
* **Verify**, for pull request testing: select **Review** > **Verify** in the sidebar and choose the repository, or select **Pull Requests** > **Settings** on the repository's page. The **Turn off automatic Verify** link in a Verify comment opens the same page.

| Setting | Page | Default | What it does |
| - | - | - | - |
| **Default branch** | Test suite settings | The branch chosen when you added the repository | The branch user journey runs test. You can choose another branch before each run. Automatic pull request runs use the pull request's branch. |
| **Environment** | Test suite settings | The environment chosen when you added the repository | The prepared environment for Verify runs in this repository. |
| **Test instructions** | Test suite settings | Empty | Extra instructions for the testers in user journey and pull request runs, up to 20,000 characters. |
| **Enable PR testing** | Verify | On | Allows manual and automatic pull request runs. When it's off, automatic runs are paused, and `@coderabbitai verify` replies with a link to these settings. |
| **Auto Verify** | Verify | Off | Tests qualifying pull requests automatically when they are opened. |
| **Also verify new commits** | Verify | Off | Tests qualifying pull requests automatically when new commits are pushed. Requires **Auto Verify**. |
| **Custom selection rules** | Verify | Empty, which uses the default rules | Decides which pull requests automatic runs test, up to 20,000 characters. See [Selection rules](https://docs.coderabbit.ai/verify/pull-requests.md#selection-rules). |

Select **Save changes** to apply your edits. Settings apply to future runs.

## Write test instructions

Test instructions tell every tester in the repository what it can't learn from the code: where the app starts, which account to use, and what matters most. The field's hint says: "Include the test account to use, the starting URL, and the behavior to verify. Reference configured credentials instead of pasting secrets here."

For example:

```text wrap theme={null}
Start at http://localhost:3000. Sign in with the test account in the TEST_USER_EMAIL and TEST_USER_PASSWORD variables. Use the seeded "Acme" workspace. Treat any change to the cart total as important.
```

Keep secret values in the environment's variables and secrets, and refer to them by name.

## Turn on automatic runs

Automatic runs are off for a repository you add. To turn them on:

**1. Open the Verify settings**

Select **Review** > **Verify** in the sidebar and choose the repository, or select **Pull Requests** > **Settings** on the repository's page. Check that **Enable PR testing** is on.

**2. Choose when to run**

Expand **Automatic runs**. Turn on **Auto Verify** to test pull requests when they are opened. To also test new pushes, select **Also verify new commits**. Turning on **Auto Verify** alone doesn't test new commits.

**3. Adjust the selection rules**

Optionally, add **Custom selection rules** to change which pull requests qualify. See [Selection rules](https://docs.coderabbit.ai/verify/pull-requests.md#selection-rules).

**4. Confirm and save**

In the **Enable automatic Verify runs?** dialog, select **Enable automatic runs**, then select **Save changes**.

## Who can set up Verify

| Task | Who can do it |
| - | - |
| Create and prepare an environment | Organization admins with an assigned Review seat or an active trial. See [Coding environments](https://docs.coderabbit.ai/code/environments.md). |
| Add a repository, change its settings, create user journeys, start and schedule runs | Users with the Coding Agent write permission: Admins and Members by default. |
| View repositories, runs, and evidence | Users with the Coding Agent read permission: Admins and Members by default. |
| Start a pull request run with `@coderabbitai verify` | Users with write access to the repository in your Git provider. On GitHub, if the repository's configuration sets [`chat.allow_non_org_members`](https://docs.coderabbit.ai/reference/configuration#param-chat-allow-non-org-members) to `false`, they must also be members of the GitHub organization. |

## What's next

> [card] [Test pull requests](https://docs.coderabbit.ai/verify/pull-requests.md)
>
> Start a run with a comment or automatically, and read the Verify comment.

> [card] [User journeys](https://docs.coderabbit.ai/verify/user-journeys.md)
>
> Build a library of critical flows and test them on demand or on a schedule.

> [card] [Access and billing](https://docs.coderabbit.ai/verify/access-and-billing.md)
>
> Supported platforms, permissions, and what the beta costs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.