You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jukka Karvanen (JIRA)" <ji...@apache.org> on 2019/04/15 11:50:00 UTC

[jira] [Created] (KAFKA-8233) Helper class to make it simpler to write test logic TopologyTestDriver

Jukka Karvanen created KAFKA-8233:
-------------------------------------

             Summary: Helper class to make it simpler to write test logic TopologyTestDriver
                 Key: KAFKA-8233
                 URL: https://issues.apache.org/jira/browse/KAFKA-8233
             Project: Kafka
          Issue Type: Improvement
          Components: streams
            Reporter: Jukka Karvanen


When using TopologyTestDriver you need to call ConsumerRecordFactory to create ConsumerRecord passed into pipeInput method to write to topic. Also when calling readOutput to consume from topic, you need to provide correct Deserializers each time.

You easily end up writing helper methods in your test classed, but this can be avoided when adding generic input and output topic classes.

This improvement adds TestInputTopic class which wraps TopologyTestDriver  and ConsumerRecordFactory methods as one class to be used to write to Input Topics and TestOutputTopic class which collects TopologyTestDriver  reading methods and provide typesafe read methods.

 

 Example of how Stream test looks after using this classes:

[https://github.com/jukkakarvanen/kafka-streams-examples/blob/InputOutputTopic/src/test/java/io/confluent/examples/streams/WordCountLambdaExampleTest.java]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)