Testing streams

Testing streams

Akka Streams comes with an akka-stream-testkit module that provides tools which can be used for controlling and asserting various parts of the stream pipeline.

Probe Sink

Using probe as a Sink allows manual control over demand and assertions over elements coming downstream. Streams testkit provides a sink that materializes to a TestSubscriber.Probe.

Source(1 to 4)
  .filter(_ % 2 == 0)
  .map(_ * 2)
  .expectNext(4, 8)

Probe Source

A source that materializes to TestPublisher.Probe can be used for asserting demand or controlling when stream is completed or ended with an error.



List by example various operations on probes. Using probes without a sink.