Skip to content

Testing

Use etl4s with the testing framework of your choice

Run nodes like normal functions

import etl4s._

val times5: Transform[Int, Int] = Transform(_ * 5)

times5(5)

You will get:

25

Run pipelines with unsafeRun or safeRun:

import etl4s._

val plus2:  Transform[Int, Int] = Transform(_ + 2)
val times5: Transform[Int, Int] = Transform(_ * 5)

val p: Pipeline[Int, Int] = plus2 ~> times5

p.unsafeRun(2)
Gives
20
However, if you use safeRun as below
p.safeRun(2)
You will get a response wrapped in a scala.util.Try
Success(20)

Testing with Traces

For testing with execution insights, see the Pipeline Tracing section. You can test traced execution and cross-node communication:

import etl4s._

val pipeline = Transform[String, Int](_.length)
val trace = pipeline.unsafeRunTrace("test")

assert(trace.result == 4)
assert(trace.timeElapsedMillis >= 0)
assert(!trace.hasErrors)