Discover Kapoeira our open source solution to test Kafka Streams !

June 14, 2023

What is Kapoeira ?

Kapoeira is our solution to create integration tests on Kafka Streams. It uses Gherkin syntax, so it is very simple to write and read your tests.

Why Kapoeira ?

In Lectra, we developed lots of Kafka Streams, which are small bricks to transform and aggregate data. We needed a tool to test each stream individually. We first used Topology Test Driver, which is very efficient to write fast unit tests. But this solution did not test the integration with the Kafka cluster. Moreover, our QA could not write or read those tests (made for developers). So we strongly needed a solution to automate QA's manual integration tests. On top of that, we also would like to write end-to-end tests, covering several streams.
The state of art did not provide us the solution at this time.

How did Kapoeira start ?

We wanted to develop a new tool similar to Karate, a very interesting tool for HTTP-based APIs. It allows you to write a feature file, in a programming language agnostic syntax, Gherkin, that is similar to specifications.
In 2020, we created Kapoeira, based on Cucumber Scala, using specific Gherkin DSL.
Kapoeira is able to produce a message in a Topic "In", and consume the result in the Topic "Out", for then, assert each field of the result.

Example of Kapoeira Feature ?

Let's take the example of a stream doing an "upper case" operation :

1. Setup your input topics (Background)
2. Setup your output topics (Background)
3. Produce some data in your input topic (When)
4. Consume data from your output topic (Then)
5. Assert the input and output data (assert)

After launching, a report is generated to synthesize the result :

How can I use Kapoeira ?

Kapoeira and its sources are now available in Github !
Check the README, you will find :

Do not hesitate to test it and send us your feedbacks !
You are also welcome to contribute to help us improving this magnificent tool.