Test your app
Write unit tests, test locally, and install pre-release versions into test accounts to verify your OCP app.
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 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
ImportantDev 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:
ocp app prepare --bump-dev-version --publish--bump-dev-version– Automatically increments the dev pre-release tag (such as1.0.0-dev.1to1.0.0-dev.2) before building. This flag only works with-devtagged versions.--publish– Automatically publishes the app after a successful build, so you do not need to runocp directory publishseparately.
To prepare and publish separately, run:
ocp app prepare
ocp directory publish [email protected]Install a pre-release version
Install 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_app
NoteDev and beta versions auto-upgrade existing installations when you publish a new version with the same tag. For example, publishing
1.0.0-dev.2automatically upgrades all installations running1.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.
Updated about 23 hours ago
