---
title: Test your app
slug: optimizely-connect-platform/docs/testing
docTags: 
createdAt: 2026-07-23T12:37:04.808Z
---

Thorough testing ensures your app works as expected before you submit it for review. OCP supports unit testing, local testing, and pre-release installations for end-to-end verification.

## Write unit tests

OCP app templates include [Vitest](https://vitest.dev/) for unit testing, but you can use any unit testing framework as long as you configure it to run using the `yarn test` command. Unit tests run before uploads and when building your app to run on OCP infrastructure. If any tests fail, you cannot publish your app.

See the basic template, generated from the `ocp app init` command, for unit test examples, including a state machine-based job.

## Test locally

The OCP local testing tool lets you preview your settings form, test functions with custom payloads, run jobs, and debug issues with detailed logs, without publishing to OCP.

Start the local testing tool:

```bash
ocp dev
```

See Local testing for installation and usage instructions. See Feature comparison for a comparison of local and remote testing.

## Install into test accounts

:::hint{type="warning"}
**Important**

Dev versions are for development and testing only. Do not use dev versions for production workloads.
:::

Install apps into an OCP account from the CLI, even when they are not visible in the **App Directory**. This applies to development and beta versions.

Use pre-release tags, like `-dev` or `-beta`, to publish a version without making it public or auto-upgrading existing installations.

### Build and publish a pre-release version

To build and publish a dev version to OCP in one step, run:

```shell
ocp app prepare --bump-dev-version --publish
```

- `--bump-dev-version` – Automatically increments the dev pre-release tag (such as `1.0.0-dev.1` to `1.0.0-dev.2`) before building. This flag only works with `-dev` tagged versions.
- `--publish` – Automatically publishes the app after a successful build, so you do not need to run `ocp directory publish` separately.

To prepare and publish separately, run:

```shell
ocp app prepare
ocp directory publish my_app@1.0.0-dev.1
```

### Install a pre-release version

Install pre-release apps from the CLI:

```shell
ocp directory install my_app@0.0.0-dev.1 TRACKER_ID
```

Replace `TRACKER_ID` with the tracker ID of the OCP account where you want to install the app. When this command completes, your app is installed and ready to use. Verify the app was installed successfully with the following command:

```shell
ocp directory list-installs my_app
```

:::hint{type="info"}
**Note**

Dev and beta versions auto-upgrade existing installations when you publish a new version with the same tag. For example, publishing `1.0.0-dev.2` automatically upgrades all installations running `1.0.0-dev.1`.
:::

### Deploy to a preview track

:::hint{type="danger"}
**Experimental**

Preview tracks are experimental.
:::

Instead of bumping a `-dev` version for each change, deploy to a preview track, such as `dev/jdoe`. This requires `runtime: node22` or later and `@zaiusinc/app-sdk` 3 or later. Run the following command:

```shell
ocp app deploy
```

The command builds and publishes the app in one step and derives the version from your app content, such as `dev/jdoe/95544ac`.

Install your app in a test account so that the account follows the track. You do this once:

```shell
ocp directory install my_app --preview-track dev/jdoe TRACKER_ID
```

Each later `ocp app deploy` command moves the installation to the version you deployed, so you do not need to reinstall. To return the track to an earlier version, run `ocp app rollback --preview-track dev/jdoe`.

See [Deploy apps with preview tracks](docId\:gLoc5c6DPRHSfUcBL6bpf) for the full workflow, including promotion, rollback, and limits.

### Uninstall an app

To uninstall an app from an account, run the following command:

```shell
ocp directory uninstall my_app@0.0.0-dev TRACKER_ID
```

## Test in a sandbox

After you install your app into a test account, verify the following in the OCP UI:

- The settings form renders correctly and saves values as expected.
- Functions respond to the correct events with the expected behavior.
- Jobs run on schedule and process data correctly.
- Lifecycle hooks (install, upgrade, uninstall) execute without errors.
