zitadel policy test
Run the test cases in .zitadel/policies/ against the policies.
A policy's cases live beside it in <operation>.test.json, such as auth.factor.password.set.test.json: each case holds an input, such as a password, and the decision you expect. Inputs go in that file, not on the command line. https://preview.zitadel.com/docs/guides/test-policies walks through an example.
The server evaluates every case, so the command needs a connection to it. By default the cases run against the policy files in .zitadel/policies/; --release runs them against the policies a release pins. Testing publishes nothing and leaves the live policies as they are.
Usage
npx @zitadel/cli@latest policy test [<operation>] [flags]Arguments
| Argument | Description |
|---|---|
<operation> | Test only this operation's policy, such as auth.factor.password.set. |
Flags
| Flag | Description |
|---|---|
--release <value> | Test the policies a release pins (rel_…) instead of the files in .zitadel/policies/. |
-s, --server <value> | Override the resolved server URL. |
-e, --env <value> | Environment to run against, e.g. production. Defaults to ZITADEL_ENV, then the hosting platform's build (VERCEL_ENV, or Netlify's CONTEXT), then development. |
--env-file <value> | Read ZITADEL_* values from this file ahead of the process environment. A relative path is read from the current directory, not from --cwd. Cannot be combined with --env. |
It also takes the global flags.
Examples
npx @zitadel/cli@latest policy test
npx @zitadel/cli@latest policy test auth.factor.password.set
npx @zitadel/cli@latest policy test --release rel_01KXB7C2M4N7F0N9WD3P2E4YM7
npx @zitadel/cli@latest policy test --jsonWas this helpful?