liveBook · Manning

TopologyTestDriver

As explained in Kafka for Architects

TopologyTestDriver is a Kafka Streams testing class that executes and verifies a topology without requiring a running Kafka cluster.

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

How Kafka for Architects covers it

How deep it goes
Explains test topics, serialization, output assertions, simulated time, and state inspection; defers real-cluster communication to integration testing.
Examples
Uses TestInputTopic and TestOutputTopic to pipe serialized records, verify outputs, advance time, and inspect intermediate state.
What it assumes
Assumes a Kafka Streams topology and configured key and value serializers and deserializers.
What you can do after
Evaluate Kafka Streams transformations and stateful behavior without deploying a Kafka cluster.
How it connects
Connects Kafka Streams topologies with unit testing, serialization, stateful stream processing, and integration testing.

Also explained in

Compare how 2 books explain TopologyTestDriver →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.