In OPA, policies written in Rego can be tested using Rego test rules (for example, rules prefixed with test_) and executed with the OPA CLI. These tests assert expected policy behavior and are commonly used as unit tests during development and when compiling bundles for server-side use.
However, when policies are compiled to WebAssembly (WASM) and embedded in another application, it’s less clear how this testing workflow translates.
Is there a way to run or validate Rego tests against policies that have been compiled to WASM, or is the recommended approach to test policies before compilation using the standard OPA test tooling?
There is this option use opa test -twasm, for having the same tests evaluated via the wasm evaluator but will this be enough to validate that this SDK would be compatible with the wasm bundle?
Can the opa-java-wasm SDK be used to load and execute a compiled WASM policy in tests to validate that it behaves correctly at runtime?
Are there recommended patterns, tools, or best practices for integration or end-to-end testing of OPA WASM policies using the Java SDK?