Skip to main content
Version: 2.x

Installing ZIO Test

In order to use ZIO Test, we need to add the required configuration in our SBT settings:

// ZIO Test: the test library (test scope)
libraryDependencies += "dev.zio" %% "zio-test" % "2.1.27" % Test

// ZIO Test sbt integration (test scope)
libraryDependencies += "dev.zio" %% "zio-test-sbt" % "2.1.27" % Test

// ZIO Test derivation of test generators (test scope)
libraryDependencies += "dev.zio" %% "zio-test-magnolia" % "2.1.27" % Test

If our SBT version is older than 1.8.0, we also need to add the test framework manually:

testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")

NOTE: In order to use the live version of a service in our tests, we can use some new helpful test aspects e.g withLiveClock, withLiveConsole, withLiveRandom, withLiveSystem, etc.

ZIO Chat

Hi there! 👋 I'm ZIO Chat, your friendly neighborhood ZIO expert. I'm here to help you navigate the world of ZIO. Whether you're a seasoned pro or just starting out, fire away with your ZIO questions. I will hit you back with the best insights I've got. Let's dive into the world of ZIO together!