Skip to content
Development preview · 2.0.0-SNAPSHOT

Testing guide

Start with the test that can directly verify the behavior: a unit test for parsing rules, a real database for transactions, or an integration test for a workflow across modules. The semantic verification guide lists suites, commands, and coverage for execution behavior.

Layer Scope Typical use
Unit One class or pure rule Parsing, validation, routing, state transitions, and error mapping.
Module integration One Maven module with its dependencies Spring wiring, generated code, resource lifecycle, and provider behavior.
Store contract A real first-party database Provider Transaction, migration, locking, lease, and recovery semantics.
Cross-module integration Engine, Deploy, Durable, or Server together Public workflows and the exact effective version.
Workbench pnpm workspace TypeScript, contract, UI, and browser behavior.

Tests must be deterministic. Do not depend on execution order, a developer home directory, the default timezone, uncontrolled external services, or static state left by an earlier test. Database and browser suites must declare and provision their infrastructure explicitly.

Keep tests in the corresponding production module. Test public behavior through public APIs where possible, and name each test for the rule it checks. For a defect fix, write a regression test with the smallest input that reproduces the problem.

For concurrency and lifecycle code:

  • use latches, barriers, or a controllable clock instead of arbitrary sleeps;
  • check who releases resources, when cancellation takes effect, whether stale lease tokens are rejected, and when shutdown completes;
  • close executors, class loaders, database connections, and child processes;
  • verify successful execution and cases where an error must prevent further execution.

Tests of generated Java code should check output values and execution behavior. Avoid assertions that depend on incidental formatting. A source snapshot is useful only when the emitted structure is itself a contract.

Migration and transaction behavior must be verified against the supported first-party databases used by the feature. Use the exact PostgreSQL and MySQL versions pinned in release-baselines.json for the required release matrix. Supported surfaces lists the modules that support them. H2 tests do not establish production database compatibility.

For a persistence change, cover:

  1. clean schema creation and migration admission;
  2. commit and rollback behavior;
  3. concurrent claims or compare-and-set transitions;
  4. restart, lease expiry, and recovery behavior when applicable;
  5. exact error or dead-letter handling.

Provider implementations must pass their provider-neutral Store testkit.

When changing a schema, persisted format, or identity rule, verify that saved values can be read back under the same rules. Use fixed inputs and expected results to check encoding and digests; determine the expected results independently of the implementation under test. Check size boundaries and reject unknown or malformed schemas and data formats.

Reopen saved data and exercise affected restart recovery, live Waits, unfinished Effects, and retained terminal results. A codec round trip alone does not establish those behaviors. See Versions and data integrity for supported combinations and data-integrity requirements.

Load only the Spring context needed by the test. Check that required components are present, incomplete Store configuration prevents startup, and disabled optional features do not unexpectedly require a database.

Server endpoint tests cover request validation, authentication modes, Problem Details, OpenAPI structure, database changes, and idempotency. Workbench Server /api/** is paired with the frontend from the same release. When changing it, update controller types, the OpenAPI snapshot, generated frontend types, runtime validation, and tests together.

Configure a supported JDK as described in Contributing, then run ./mvnw -version to check which JDK Maven actually uses. Run the commands below from the repository root.

For example, run the Core event-publishing test. Replace the module and test class when checking a different behavior:

Terminal window
./mvnw -pl compileflow-core -am -Dtest=ProcessEventPublisherTest -Dsurefire.failIfNoSpecifiedTests=false test

Afterward, inspect the target module’s target/surefire-reports. Confirm that the selected test ran with no failures or errors. failIfNoSpecifiedTests=false allows prerequisite modules to have no matching tests; a successful build alone does not establish that the target test ran.

Replace <module> and <TestClass> in the following commands with actual names before running them.

Build dependent modules from the reactor:

Terminal window
./mvnw -pl <module> -am -DskipTests compile

Run a focused integration test:

Terminal window
./mvnw -pl compileflow-integration-tests -am -Dtest=<TestClass> -Dsurefire.failIfNoSpecifiedTests=false test

Architecture source checks need JDK 17 or newer: set JAVA_HOME, or put java and javac on PATH. They parse Java 17 syntax, recognize fully qualified references, and skip comments and strings. Reflection strings still need separate review, and type checking remains the compiler’s job.

Create a Python 3.12 environment, install the pinned Markdown parser dependencies, then run the documentation and architecture checks from the repository root:

Terminal window
python3.12 -m venv target/docs-venv
target/docs-venv/bin/python -m pip --isolated install \
--index-url https://pypi.org/simple --only-binary=:all: --require-hashes \
-r scripts/requirements-docs.txt
. target/docs-venv/bin/activate
python3 scripts/check_repository_hygiene.py
python3 scripts/check_bilingual_parity.py
python3 scripts/check_architecture_boundaries.py
python3 scripts/check_spec_impl_parity.py
git diff --check

Run the Workbench checks from compileflow-workbench using the scripts in its package.json, normally:

Terminal window
pnpm type-check
pnpm test
pnpm build

When a change affects a browser workflow, run its Playwright tests and explicitly configure the Server and browser targets. An unavailable target must cause a failure, not silently skip tests that should have run.

Use a dedicated environment because browser integration tests create definitions, versions, deployments, and invocations. The shared suites open and cancel the confirmations for global dead-letter requeue and execution-log purge; they do not execute those global operations. Retry tests use only invocation IDs they created. Isolated component and Server tests verify successful global maintenance.

When a change affects packaging, configuration, migrations, authentication, or cross-module wiring, run the packaged Server as an executable JAR with a supported database. Verify startup, schema admission, one authenticated request, one process execution, one deployment operation when enabled, and graceful shutdown. A unit test or H2 run alone is insufficient evidence for these changes.

For an intermittent failure, retain the seed, input, thread state, database logs, and relevant configuration in a protected location. Redact secrets and business data before sharing diagnostics. Determine whether the cause is a product race, resource leak, environment dependency, or unstable test. Fix the cause and add a repeatable regression test. Longer sleeps, weaker assertions, and unlimited retries hide the problem.

  • New behavior has a test; a fixed defect has a regression test.
  • Tests prove the public contract at the narrowest appropriate layer.
  • Concurrency and timing tests use controlled synchronization and clocks.
  • Persistence changes are verified on each relevant supported Provider.
  • API, configuration, REST, schema, wire, and generated-client changes cover their corresponding contract layers.
  • Relevant tests and repository checks have passed on the reviewed source; the required suites ran without unaccounted skips. A release also needs its same-commit CI and database matrix evidence.
  • Generated build artifacts are excluded from the submitted changes.