Send messages, listen on topics, assert on payloads — using the same Karate syntax you already use for REST. Avro, multiple listeners, consumer groups, and SASL authentication all built in.
Feature: Order processing pipeline
Background:
* bootstrap 'broker1:9092,broker2:9092'
Scenario: Produce and consume order event
# Publish an order
Given topic 'orders.created'
And key 'order-123'
And value
{ id: 123, item: 'Laptop', qty: 1 }
When send
# Listen for the processed event
Given topic 'orders.processed'
And group 'karate-tests'
When listen 5000
Then match listen.value ==
{ id: 123, status: 'COMPLETE',
timestamp: '#notnull' }
Kafka-Specific Features
Work with Avro-encoded messages natively. Schema registry integration handled for you — no custom serializers to maintain.
Subscribe to multiple topics concurrently within a single test. Each listener runs on its own thread, managed by Karate.
Production authentication out of the box — SASL/PLAIN, SASL/SCRAM, SASL/GSSAPI, and mutual TLS with cert rotation.
Full consumer group management including offset control, rebalancing behavior, and seek-to-beginning for replay testing.
Run thousands of Kafka tests in parallel. Built-in support for Gatling performance testing with your existing feature files.
POST via REST, assert a Kafka event, verify the database via gRPC — all in the same scenario. End-to-end in one file.
When to Use Kafka Testing
Verify that publishing to one topic triggers the right chain of downstream events across services.
Assert that database changes surface in the right Kafka topics with the correct schema and ordering.
Seek to specific offsets and replay historical events to validate state reconstruction logic.
Test connector output, stream transformations, and KTable state without spinning up custom harness code.
Licensing
Karate Kafka requires an Enterprise runtime license for CI/CD deployment and the Pro tier of IntelliJ or VS Code plugins for development.
Book a 30-minute demo tailored to your Kafka setup — topics, schemas, auth, and all.