TopologyTestDriver tests an entire Kafka Streams topology without a running Kafka cluster or mock producers and consumers. It exercises the topology’s interconnected processing nodes as events are transformed, enriched, or stored. section 10.3.1
A topology test typically uses:
- TestInputTopic and TestOutputTopic objects configured with topic names and key/value serializers and deserializers. section 10.3.1
- Input records piped into simulated topics, with output records read back and verified after processing. section 10.3.1
- Serialized and deserialized messages that mirror production byte-array communication, plus simulated time and inspectable intermediate state for stateful processing. section 10.3.1
Testing a stateful topology
Feed records into a TestInputTopic, allow the topology to transform or enrich them, advance simulated time when needed, and verify records emitted through a TestOutputTopic or inspect intermediate state. section 10.3.1
TopologyTestDriver validates stream-processing behavior while remaining isolated from broker connectivity. Integration tests are still needed to verify communication with a real Kafka cluster, including serialization, topic configuration, and connectivity. section 10.3.1

