1. Introduction

In this tutorial, we will quickly explore some basic to high-level approaches for testing microservice applications built using Kafka. Also, we will learn about the advantages of the declarative way of testing Kafka applications over the traditional/existing way of testing.

For everything explained here, we can find running code examples in the “Conclusion” section of this post.

To keep the tutorial concise, we will demonstrate only the below aspects.

  1. Producer Testing
  2. Consumer Testing
  3. Hooking Both Producer and Consumer Tests
  4. Producing RAW records and JSON records
  5. Consuming RAW records and JSON records
  6. Traditional Testing Challenges.
  7. Advantages of Declarative Style Testing (IEEE Paper)
  8. Combining REST API Testing with Kafka Testing
  9. Spinning Up Kafka in Docker - Single Node and Multi-Node

I strongly recommend reading through the Minimum Things We Need To Know For Kafka Testing post before proceeding with this tutorial.

2. Kafka Testing Challenges

The difficult part is some part of the application logic or a DB procedure keeps producing records to a topic and another part of the application keeps consuming the records and continuously processes them based on business rules.

The records, partitions, offsets, exception scenarios, etc. keep on changing, making it difficult to think in terms of what to test, when to test, and how to test.

data-pipe-line-random

#microservices #api testing #microservice best practices #kafka tutorial #kafka topics

A Quick and Practical Example of Kafka Testing
1.70 GEEK