Skip to content

Testing

Generate Citrus integration tests for your routes.

Running Test Generation

/camel-test <flow-name>    # Generate tests for one flow
/camel-test --all          # Generate tests for all flows

Validation Loop

The /camel-test command includes an automated validation loop using the json-yaml-validator-maven-plugin:

./mvnw com.dataliquid.maven:json-yaml-validator-maven-plugin:2.0.0:validate \
  -Dschema.validator.schemaFile=.camel-kit/.cache/citrus/{version}/citrus-testcase.json \
  -Dschema.validator.sourceDirectory=test \
  -Dschema.validator.includes=**/*.camel.it.yaml

Test Scenarios

Based on your flow design, tests are generated for:

ScenarioWhen generated
Happy PathAlways
Error HandlingAlways
Dead Letter QueueIf DLQ configured
IdempotencyIf idempotent consumer used
Circuit BreakerIf resilience pattern used
Filter ConditionsIf filter EIP used
Split ProcessingIf split EIP used

Test Files

Tests are saved to test/<flow-name>.camel.it.yaml following the Camel JBang naming convention, with test data in test/data/.

Running Tests

# Install Citrus JBang app
jbang app install citrus@citrusframework/citrus

# Run tests (Docker required for Testcontainers)
cd test
citrus run order-ingestion.camel.it.yaml

# Or using Camel test plugin
camel plugin add test
camel test run test/order-ingestion.camel.it.yaml