One Gherkin spec, a unit test and an integration test
The same .feature file runs in-process against the real Chenile pipeline and against a deployed server. Swap the glue, not the spec.
Exchange
Payload
Unit / component — cucumber-utils
Spring MockMvc stands the service up in an ephemeral in-process instance and drives it from the outside. Because the request passes through the real Chenile pipeline, it exercises the service and its interceptors — governance is under test. Fast enough for every build.
Integration — it-cucumber-utils · chenile-bdd
The identical scenarios run over REST Assured against a really deployed server, verifying the wire, packaging, config and environment. it-cucumber-sec-utils does the same for secured endpoints. Same spec, run against staging.
Every test makes the whole call, with the policies on
Chenile does not test a method in isolation. A test sends an HTTP request through the real pipeline, with the same interceptors the deployed service runs, and can bring up real brokers and an identity provider. The harness for all of it comes with Chenile.
Its own Chenile configuration
A service's tests load their own Chenile properties: TestService.properties points chenile.properties at TestService-chenile.properties, which sets the test monolith name, the service definitions and the interceptors. With security on, it sets chenile.post.processors=securityInterceptor, so every test request is checked like a production one.
MockMvc, not a method call
The request goes through Spring MVC, the Chenile entry point and every interceptor, in a Spring test context, without opening a port. Request binding, headers, security, tenancy and the GenericResponse envelope are all under test, which a plain JUnit test of the service class never reaches.
Real infrastructure, by inheritance
Extend a base class and Testcontainers starts the real thing, then points the test's configuration at it:
KafkaBaseTest: a Kafka broker; setsspring.kafka.bootstrap-serversMqttBaseTest: a HiveMQ broker; setspubsub.mqtt.connection.ServerURIsBaseSecurityTest: a Keycloak with realmstenant0andtenant1, each with a normal and a premium user
// A Kafka-backed service test: inherit the broker
public class TestKafka extends KafkaBaseTest { … }
// A secured scenario gets a real token from the container
When I construct a REST request with authorization header
in realm "tenant0" for user "t0-premium" and password "t0-premium"
And I POST a REST request to URL "/order" with payload
"""
{"item":"pen","qty":2}
"""
Then success is trueWhere they live
KafkaBaseTest and MqttBaseTest are in cucumber-mqtt-utils (chenile-messaging, package org.chenile.mqtt.test); BaseSecurityTest and the security steps are in cucumber-sec-utils (chenile-security). JGen's process management blueprint generates server and worker tests that already extend KafkaBaseTest. Generated service tests use an in-memory H2 database by default; Testcontainers can run a real one too, as the JDBC query catalog's PostgreSQL tests do.