Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 35fa879

Browse files
authored
Update README.md
1 parent ccbaf58 commit 35fa879

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

‎README.md‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# scalatest-embedded-kafka
2-
A library that provides an in-memory Kafka broker to run your ScalaTest specs against.
2+
A library that provides an in-memory Kafka instance to run your tests against.
3+
4+
*As of version 1.1.1 the library is not dependent anymore on ScalaTest and won't transitively ScalaTest into your build*
35

46
Inspired by https://github.com/chbatey/kafka-unit
57

@@ -14,22 +16,22 @@ Inspired by https://github.com/chbatey/kafka-unit
1416

1517
### Version compatibility matrix
1618

17-
scalatest-embedded-kafka is available on Bintray and Maven Central, compiled for both Scala 2.11 and 2.12.
19+
scalatest-embedded-kafka is available on Bintray and Maven Central, compiled for both Scala 2.11 and 2.12. Scala 2.10 is supported until `0.10.0`. Scala 2.12 is supported from `0.11.0` onwards, following Apache Kafka release cycle.
1820

19-
* Scala 2.10 is supported until `0.10.0`
20-
* Scala 2.11 is supported for all versions
21-
* Scala 2.12 is supported from `0.11.0`.
21+
Currently there's no support for Scala 2.13-Mx as Kafka artifacts are not published for these versions.
2222

23-
Starting from 1.0.0, versions match the version of Kafka they're built against.
23+
Starting from 1.0.0, versions match the version of Kafka they're built against. However in the past there were some mismatches - the easiest way is to check through the git history of the `build.sbt` file
2424

2525
*If you're using Kafka 1.1.0, please use version `1.1.0-kafka1.1-nosr` - this version doesn't pull in the Confluent Schema Registry by default*
2626

2727
### How to use
2828

29-
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka" % "1.1.0-kafka1.1-nosr" % "test"`
30-
* Have your `Spec` extend the `EmbeddedKafka` trait.
29+
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka" % "1.1.1" % "test"`
30+
* Have your class extend the `EmbeddedKafka` trait.
3131
* Enclose the code that needs a running instance of Kafka within the `withRunningKafka` closure.
3232

33+
An example, using ScalaTest:
34+
3335
```scala
3436
class MySpec extends WordSpec with EmbeddedKafka {
3537

@@ -49,7 +51,8 @@ class MySpec extends WordSpec with EmbeddedKafka {
4951

5052
### Use without the `withRunningKafka` method
5153

52-
A `EmbeddedKafka` companion object is provided for usage without the `EmbeddedKafka` trait. Zookeeper and Kafka can be started and stopped in a programmatic way.
54+
A `EmbeddedKafka` companion object is provided for usage without extending the `EmbeddedKafka` trait. Zookeeper and Kafka can be started and stopped in a programmatic way. This is the recommended usage if you have more than one test in your file and you don't want to start and stop Kafka and Zookeeper on every test.
55+
5356

5457
```scala
5558
class MySpec extends WordSpec {
@@ -194,13 +197,13 @@ consumer.consumeLazily[(String, String)]("from-this-topic").take(3).toList shoul
194197

195198
## scalatest-embedded-kafka-streams
196199

197-
A library that builds on top of `scalatest-embedded-kafka` to offer easy testing of [Kafka Streams](https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams) with ScalaTest.
200+
A library that builds on top of `scalatest-embedded-kafka` to offer easy testing of [Kafka Streams](https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams).
198201

199202
It takes care of instantiating and starting your streams as well as closing them after running your test-case code.
200203

201204
### How to use
202205

203-
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka-streams" % "1.1.0-kafka1.1-nosr" % "test"`
206+
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-kafka-streams" % "1.1.1" % "test"`
204207
* Have a look at the [example test](kafka-streams/src/test/scala/net/manub/embeddedkafka/streams/ExampleKafkaStreamsSpec.scala)
205208
* For most of the cases have your `Spec` extend the `EmbeddedKafkaStreamsAllInOne` trait. This offers both streams management and easy creation of consumers for asserting resulting messages in output/sink topics.
206209
* If you only want to use the streams management without the test consumers just have the `Spec` extend the `EmbeddedKafkaStreams` trait.
@@ -247,8 +250,8 @@ If you need to serialize and deserialize messages using Avro, a [Confluent Schem
247250
### How to use
248251

249252
* In your `build.sbt` file add the following resolver: `resolvers += "confluent" at "https://packages.confluent.io/maven/"`
250-
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-schema-registry" % "1.1.0-kafka1.1-nosr" % "test"`
251-
* Have your `Spec` extend the `EmbeddedKafkaWithSchemaRegistry` trait.
253+
* In your `build.sbt` file add the following dependency: `"net.manub" %% "scalatest-embedded-schema-registry" % "1.1.1" % "test"`
254+
* Have your test extend the `EmbeddedKafkaWithSchemaRegistry` trait.
252255
* Enclose the code that needs a running instance of Kafka within the `withRunningKafka` closure.
253256
* Provide an implicit `EmbeddedKafkaConfigWithSchemaRegistryImpl`.
254257

@@ -274,7 +277,7 @@ class MySpec extends WordSpec with EmbeddedKafkaWithSchemaRegistry {
274277

275278
The `net.manub.embeddedkafka.avro.schemaregistry` package object provides useful implicit converters for testing with Avro and Schema Registry.
276279

277-
## Using streams
280+
### Using streams
278281

279282
* For most of the cases have your `Spec` extend the `EmbeddedKafkaStreamsWithSchemaRegistryAllInOne` trait. This offers both streams management and easy creation of consumers for asserting resulting messages in output/sink topics.
280283
* If you only want to use the streams management without the test consumers just have the `Spec` extend the `EmbeddedKafkaStreamsWithSchemaRegistry` trait.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /