Test your app
Thorough testing ensures your app works as expected before you submit it for review. OCP supports unit testing, local testing, and preview track installations for end-to-end verification.
Write unit tests
OCP app templates include Vitest 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:
ocp devSee Local testing for installation and usage instructions. See Feature comparison for a comparison of local and remote testing.
Install into test accounts
Important
Preview track versions and legacy dev versions are for development and testing only. Do not use them 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 preview track versions and legacy development and beta versions.
Deploy to a preview track
Deploy to a preview track to publish a version without making it public or auto-upgrading installations pinned to a semver version. With no flags, ocp app deploy deploys to your own track, dev/USERNAME, such as dev/jdoe. This requires runtime: node22 or later and @zaiusinc/app-sdk 3 or later. Run the following command:
ocp app deployThe 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:
ocp directory install my_app TRACKER_IDWithout a version, the installation follows your own dev/USERNAME track. Each later ocp app deploy command moves the installation to the version you deployed, so you do not need to reinstall. To return your track to an earlier version, run ocp app rollback.
To share a version with testers, deploy to a shared beta/ track with ocp app deploy --preview-track beta/qa. Alternatively, move a version you already built with ocp app promote --from dev/jdoe --to beta/qa. Testers install with ocp directory install my_app --preview-track beta/qa TRACKER_ID.
See Deploy apps with preview tracks for the full workflow, including promotion, rollback, and limits.
Build and publish a pre-release version (legacy)
Legacy
ocp app prepare, including --bump-dev-version and --publish, is deprecated. It still works and prints a deprecation warning. Use it only for apps that set a version in app.yml and cannot use ocp app deploy yet, such as apps on a runtime earlier than node22.
Use pre-release tags, like -dev or -beta, to publish a version without making it public or auto-upgrading existing installations. To build and publish a dev version to OCP in one step, run:
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:
ocp app prepare
ocp directory publish [email protected]Install a pre-release version (legacy)
Install legacy pre-release apps from the CLI:
ocp directory install [email protected] TRACKER_IDReplace 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:
ocp directory list-installs my_appNote
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.
Uninstall an app
To uninstall an app from an account, run the following command:
ocp directory uninstall [email protected] TRACKER_IDTest 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.