# Testing Kafka Connectors

DevFeed: [Testing Kafka Connectors](<https://devfeed.tech/articles/testing-kafka-connectors-18876.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/testing-kafka-connectors/>)

Published: 2022-08-25T08:20:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Kafka](<https://devfeed.tech/topics/kafka.md>), [Apache-Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>)

Tags: [apache-kafka](<https://devfeed.tech/tags/apache-kafka.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>)

## AI overview

This article explains how to test custom Kafka Connect source connectors. It covers unit tests for connector classes and polling logic, then describes a testing harness that uses an external etcd system; similar approaches can be applied to sink connectors.

## Source excerpt

Table of Contents Unit Tests Integration Tests Wrap-Up Kafka Connect is a key factor for the wide-spread adoption of Apache Kafka: a framework and runtime environment for connectors, it makes the task of getting data either into Kafka or out of Kafka solely a matter of configuration, rather than a bespoke programming job. There's dozens, if not hundreds, of readymade source and sink connectors, allowing you to create no-code data pipelines between all kinds of databases, APIs, and other systems. There may be situations though where there is no existing connector matching your requirements, in which case you can implement your own custom connector using the Kafka Connect framework. Naturally, this raises the question of how to test such a Kafka connector, making sure it propagates the data between the connected external system and Kafka correctly and completely. In this blog post I'd like to focus on testing approaches for Kafka Connect source connectors, i.e. connectors like Debezium, which ingest data from an external system into Kafka. Very similar strategies can be employed for testing sink connectors, though.