TestOutputTopic is a Kafka Streams test topic used to inspect and verify records emitted by a topology under test. It complements TestInputTopic: test code supplies serialized records to input topics, then reads deserialized results from output topics without running a Kafka cluster. section 10.3.1
Use TestOutputTopic when the test must validate the topology’s Kafka-facing behavior rather than only isolated business logic:
- Configure it with the output topic name and the serializers or deserializers for keys and values. section 10.3.1
- Read and verify records produced after input records pass through stateless or stateful processing nodes. section 10.3.1
- Use it with TopologyTestDriver to test complete topology behavior, while recognizing that real broker communication belongs in integration tests. section 10.3.1
Topology-level verification
A test pipes records into a TestInputTopic, runs the topology through its processing nodes, and inspects the corresponding TestOutputTopic to confirm the emitted records. Because serialization and deserialization occur as they do for Kafka messages, the test checks more than a direct method return value or a mocked producer call. section 10.3.1

