Skip to content

Testkit

Simon Souter edited this page Jan 30, 2017 · 23 revisions

Supports integration testing of Kafka client code by providing helpers that can start an in-process Kafka and Zookeeper server.

Resolve

Artifacts are published to bintray here: Bintray Repo To resolve using sbt, add the following resolver to your build.sbt:

resolvers += Resolver.bintrayRepo("cakesolutions", "maven")

And add the dependency:

// Latest release for Kafka 0.9.0.x:
libraryDependencies += "net.cakesolutions" %% "scala-kafka-client-testkit" % "0.9.0.0"

// Latest release for Kafka 0.10.1.1:
libraryDependencies += "net.cakesolutions" %% "scala-kafka-client-testkit" % "0.10.1.2"

Logging dependency

The testkit has a dependency on Kafka, but excludes it's transitive dependency on log4j, the logging library used by Kafka. To avoid getting a NoClassDefFoundError: org/apache/log4j/Logger, one of the following should be added to the libraryDependencies:

  • If using SLF4J:

libraryDependencies += "org.slf4j" % "log4j-over-slf4j" % "1.7.21" % "Test",

  • If using Log4j:

libraryDependencies += "log4j" % "log4j" % "1.2.14" % "Test"

Clone this wiki locally