zio.test

package zio.test

ZIO Test is a featherweight testing library for effectful programs.

The library imagines every spec as an ordinary immutable value, providing tremendous potential for composition. Thanks to tight integration with ZIO, specs can use resources (including those requiring disposal), have well- defined linear and parallel semantics, and can benefit from a host of ZIO combinators.

 import zio.test._
 import zio.test.environment.Live
 import zio.clock.nanoTime
 import Assertion.isGreaterThan

 object MyTest extends DefaultRunnableSpec {
   def spec = suite("clock")(
     testM("time is non-zero") {
       assertM(Live.live(nanoTime))(isGreaterThan(0))
     }
   )
 }

Type members

Classlikes

The Annotations trait provides access to an annotation map that tests can add arbitrary annotations to. Each annotation consists of a string identifier, an initial value, and a function for combining two values. Annotations form monoids and you can think of Annotations as a more structured logging service or as a super polymorphic version of the writer monad effect.

The Annotations trait provides access to an annotation map that tests can add arbitrary annotations to. Each annotation consists of a string identifier, an initial value, and a function for combining two values. Annotations form monoids and you can think of Annotations as a more structured logging service or as a super polymorphic version of the writer monad effect.

case class Assert(arrow: TestArrow[Any, Boolean])
Companion:
object
object Assert
Companion:
class
final class Assertion[-A] extends AssertionM[A] with (=> A) => AssertResult

An Assertion[A] is capable of producing assertion results on an A. As a proposition, assertions compose using logical conjunction and disjunction, and can be negated.

An Assertion[A] is capable of producing assertion results on an A. As a proposition, assertions compose using logical conjunction and disjunction, and can be negated.

Companion:
object
Companion:
class
sealed abstract class AssertionData
Companion:
object
Companion:
class
abstract class AssertionM[-A]

An AssertionM[A] is capable of producing assertion results on an A. As a proposition, assertions compose using logical conjunction and disjunction, and can be negated.

An AssertionM[A] is capable of producing assertion results on an A. As a proposition, assertions compose using logical conjunction and disjunction, and can be negated.

Companion:
object
object AssertionM
Companion:
class
sealed abstract class AssertionMData
Companion:
object
Companion:
class
sealed trait AssertionResult
Companion:
object
Companion:
class
sealed abstract class AssertionValue

An AssertionValue keeps track of a assertion and a value, existentially hiding the type. This is used internally by the library to provide useful error messages in the event of test failures.

An AssertionValue keeps track of a assertion and a value, existentially hiding the type. This is used internally by the library to provide useful error messages in the event of test failures.

Companion:
object
Companion:
class
sealed abstract class BoolAlgebra[+A] extends Product with Serializable

A BoolAlgebra[A] is a description of logical operations on values of type A.

A BoolAlgebra[A] is a description of logical operations on values of type A.

Companion:
object
Companion:
class
final case class BoolAlgebraM[-R, +E, +A](run: ZIO[R, E, BoolAlgebra[A]])
Companion:
object
Companion:
class
Companion:
object

Proxy methods to call package private methods from the macro

Proxy methods to call package private methods from the macro

Companion:
class
final class CustomAssertion[A, B]

CustomAssertion allows users to create their own custom assertions for use in assertTrue. They are constructed with CustomAssertion.make.

CustomAssertion allows users to create their own custom assertions for use in assertTrue. They are constructed with CustomAssertion.make.

// Definition
sealed trait Pet
case class Dog(hasBone: Boolean) extends Pet
case class Fish(bubbles: Double) extends Pet
case class Cat(livesRemaining: Int) extends Color

val lives =
 CustomAssertion.make[Pet] {
   case Cat(livesRemaining) => Right(livesRemaining)
   case other => Left(s"Expected $$other to be Cat")
 }

// Usage
suite("custom assertions")(
 test("as even") {
   val pet: Option[Pet] = Some(Cat(8))
   assertTrue(pet.is(_.some.custom(lives)) == 8)
 }
)
Companion:
object
Companion:
class

Syntax for writing test like

Syntax for writing test like

object MySpec extends DefaultMutableRunnableSpec {
 suite("foo") {
   testM("name") {
   } @@ ignore

   test("name 2")
 }
 suite("another suite") {
   test("name 3")
 }
}
abstract class DefaultRunnableSpec extends RunnableSpec[TestEnvironment, Any]

A default runnable spec that provides testable versions of all of the modules in ZIO (Clock, Random, etc).

A default runnable spec that provides testable versions of all of the modules in ZIO (Clock, Random, etc).

Companion:
class
sealed trait ErrorMessage
Companion:
object
final case class ExecutedSpec[+E](caseValue: SpecCase[E, ExecutedSpec[E]])

An ExecutedSpec is a spec that has been run to produce test results.

An ExecutedSpec is a spec that has been run to produce test results.

Companion:
object
Companion:
class
case class FailureCase(errorMessage: String, codeString: String, location: String, path: Chunk[(String, Any)], span: Span, nestedFailures: Chunk[FailureCase], result: Any)
Companion:
object
Companion:
class
final case class FailureDetails(assertion: ::[AssertionValue])

FailureDetails keeps track of details relevant to failures.

FailureDetails keeps track of details relevant to failures.

final case class Gen[-R, +A](sample: ZStream[R, Nothing, Sample[R, A]])

A Gen[R, A] represents a generator of values of type A, which requires an environment R. Generators may be random or deterministic.

A Gen[R, A] represents a generator of values of type A, which requires an environment R. Generators may be random or deterministic.

Companion:
object
object Gen extends GenZIO with FunctionVariants with TimeVariants
Companion:
class
sealed abstract class GenFailureDetails

GenFailureDetails keeps track of relevant information related to a failure in a generative test.

GenFailureDetails keeps track of relevant information related to a failure in a generative test.

Companion:
object
Companion:
class
trait GenZIO
object Macros
class MutableRunnableSpec[R <: Has[_]](layer: ZLayer[TestEnvironment, Throwable, R], aspect: TestAspect[R & TestEnvironment, R & TestEnvironment, Any, Any])(implicit evidence$1: Tag[R]) extends RunnableSpec[TestEnvironment, Any]

Syntax for writing test like

Syntax for writing test like

object MySpec extends MutableRunnableSpec(layer, aspect) {
 suite("foo") {
   testM("name") {
   } @@ ignore

   test("name 2")
 }
 suite("another suite") {
   test("name 3")
 }
}
Companion:
class
case class RenderedResult[T](caseType: CaseType, label: String, status: Status, offset: Int, rendered: Seq[T])
Companion:
object
sealed trait Result[+A]
Companion:
object
object Result
Companion:
class
abstract class RunnableSpec[R <: Has[_], E] extends AbstractRunnableSpec

A RunnableSpec has a main function and can be run by the JVM / Scala.js.

A RunnableSpec has a main function and can be run by the JVM / Scala.js.

final case class Sample[-R, +A](value: A, shrink: ZStream[R, Nothing, Sample[R, A]])

A sample is a single observation from a random variable, together with a tree of "shrinkings" used for minimization of "large" failures.

A sample is a single observation from a random variable, together with a tree of "shrinkings" used for minimization of "large" failures.

Companion:
object
object Sample
Companion:
class
object Sized
Companion:
class
Companion:
object
final implicit class SmartAssertionOps[A](self: A) extends AnyVal
final case class SourceLocation(path: String, line: Int)
Companion:
object
final case class Spec[-R, +E, +T](caseValue: SpecCase[R, E, T, Spec[R, E, T]])

A Spec[R, E, T] is the backbone of ZIO Test. Every spec is either a suite, which contains other specs, or a test of type T. All specs require an environment of type R and may potentially fail with an error of type E.

A Spec[R, E, T] is the backbone of ZIO Test. Every spec is either a suite, which contains other specs, or a test of type T. All specs require an environment of type R and may potentially fail with an error of type E.

Companion:
object
object Spec
Companion:
class
final case class Summary(success: Int, fail: Int, ignore: Int, summary: String)
final class TestAnnotation[V] extends Serializable

A type of annotation.

A type of annotation.

Companion:
object
Companion:
class
final class TestAnnotationMap

An annotation map keeps track of annotations of different types.

An annotation map keeps track of annotations of different types.

Companion:
object
Companion:
class
sealed abstract class TestAnnotationRenderer

A TestAnnotationRenderer knows how to render test annotations.

A TestAnnotationRenderer knows how to render test annotations.

Companion:
object
final case class TestArgs(testSearchTerms: List[String], tagSearchTerms: List[String], testTaskPolicy: Option[String])
Companion:
object
object TestArgs
Companion:
class
sealed trait TestArrow[-A, +B]
Companion:
object
object TestArrow
Companion:
class
abstract class TestAspect[+LowerR, -UpperR, +LowerE, -UpperE]

A TestAspect is an aspect that can be weaved into specs. You can think of an aspect as a polymorphic function, capable of transforming one test into another, possibly enlarging the environment or error type.

A TestAspect is an aspect that can be weaved into specs. You can think of an aspect as a polymorphic function, capable of transforming one test into another, possibly enlarging the environment or error type.

Companion:
object
Companion:
class
object TestConfig

The TestConfig service provides access to default configuation settings used by ZIO Test, including the number of times to repeat tests to ensure they are stable, the number of times to retry flaky tests, the sufficient number of samples to check from a random variable, and the maximum number of shrinkings to minimize large failures.

The TestConfig service provides access to default configuation settings used by ZIO Test, including the number of times to repeat tests to ensure they are stable, the number of times to retry flaky tests, the sufficient number of samples to check from a random variable, and the maximum number of shrinkings to minimize large failures.

abstract class TestExecutor[+R <: Has[_], E]

A TestExecutor[R, E] is capable of executing specs that require an environment R and may fail with an E.

A TestExecutor[R, E] is capable of executing specs that require an environment R and may fail with an E.

Companion:
object
Companion:
class
sealed abstract class TestFailure[+E]
Companion:
object
Companion:
class
final case class TestLens[+A]()
final implicit class TestLensAnyOps[A](self: TestLens[A]) extends AnyVal
final implicit class TestLensCauseOps[E](self: TestLens[Cause[E]]) extends AnyVal
final implicit class TestLensEitherOps[E, A](self: TestLens[Either[E, A]]) extends AnyVal
final implicit class TestLensExitOps[E, A](self: TestLens[Exit[E, A]]) extends AnyVal
final implicit class TestLensOptionOps[A](self: TestLens[Option[A]]) extends AnyVal
object TestLogger

TestPlatform provides information about the platform tests are being run on to enable platform specific test configuration.

TestPlatform provides information about the platform tests are being run on to enable platform specific test configuration.

object TestResult
final case class TestRunner[R <: Has[_], E](executor: TestExecutor[R, E], platform: Platform, reporter: () => E, bootstrap: Layer[Nothing, TestLogger & Clock])

A TestRunner[R, E] encapsulates all the logic necessary to run specs that require an environment R and may fail with an error E. Test runners require a test executor, a platform, and a reporter.

A TestRunner[R, E] encapsulates all the logic necessary to run specs that require an environment R and may fail with an error E. Test runners require a test executor, a platform, and a reporter.

sealed abstract class TestSuccess
Companion:
object
Companion:
class
final case class TestTimeoutException(message: String) extends Throwable

TestVersion provides information about the Scala version tests are being run on to enable platform specific test configuration.

TestVersion provides information about the Scala version tests are being run on to enable platform specific test configuration.

sealed trait Trace[+A]
Companion:
object
object Trace
Companion:
class
object ZTest

Types

An Annotated[A] contains a value of type A along with zero or more test annotations.

An Annotated[A] contains a value of type A along with zero or more test annotations.

type Sized = Has[Service]
type TestAspectAtLeastR[R] = TestAspect[Nothing, R, Nothing, Any]

A TestAspectAtLeast[R] is a TestAspect that requires at least an R in its environment.

A TestAspectAtLeast[R] is a TestAspect that requires at least an R in its environment.

type TestAspectPoly = TestAspect[Nothing, Any, Nothing, Any]

A TestAspectPoly is a TestAspect that is completely polymorphic, having no requirements on error or environment.

A TestAspectPoly is a TestAspect that is completely polymorphic, having no requirements on error or environment.

A TestReporter[E] is capable of reporting test results with error type E.

A TestReporter[E] is capable of reporting test results with error type E.

type ZSpec[-R, +E] = Spec[R, TestFailure[E], TestSuccess]

A ZSpec[R, E] is the canonical spec for testing ZIO programs. The spec's test type is a ZIO effect that requires an R and might fail with an E.

A ZSpec[R, E] is the canonical spec for testing ZIO programs. The spec's test type is a ZIO effect that requires an R and might fail with an E.

type ZTest[-R, +E] = ZIO[R, TestFailure[E], TestSuccess]

A ZTest[R, E] is an effectfully produced test that requires an R and may fail with an E.

A ZTest[R, E] is an effectfully produced test that requires an R and may fail with an E.

A ZRTestEnv is an alias for all ZIO provided Restorable TestEnvironment objects

A ZRTestEnv is an alias for all ZIO provided Restorable TestEnvironment objects

Value members

Concrete methods

def check[R <: TestConfig, A](rv: Gen[R, A])(test: A => TestResult): URIO[R, TestResult]

Checks the test passes for "sufficient" numbers of samples from the given random variable.

Checks the test passes for "sufficient" numbers of samples from the given random variable.

def check[R <: TestConfig, A, B](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => TestResult): URIO[R, TestResult]

A version of check that accepts two random variables.

A version of check that accepts two random variables.

def check[R <: TestConfig, A, B, C](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => TestResult): URIO[R, TestResult]

A version of check that accepts three random variables.

A version of check that accepts three random variables.

def check[R <: TestConfig, A, B, C, D](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => TestResult): URIO[R, TestResult]

A version of check that accepts four random variables.

A version of check that accepts four random variables.

def check[R <: TestConfig, A, B, C, D, F](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => TestResult): URIO[R, TestResult]

A version of check that accepts five random variables.

A version of check that accepts five random variables.

def check[R <: TestConfig, A, B, C, D, F, G](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => TestResult): URIO[R, TestResult]

A version of check that accepts six random variables.

A version of check that accepts six random variables.

def check[R <: TestConfig, R1 <: R, A, B, C, D, F, G, H](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => TestResult): URIO[R1, TestResult]

A version of check that accepts seven random variables.

A version of check that accepts seven random variables.

def check[R <: TestConfig, R1 <: R, A, B, C, D, F, G, H, I](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => TestResult): URIO[R1, TestResult]

A version of check that accepts height random variables.

A version of check that accepts height random variables.

def checkAll[R <: TestConfig, A](rv: Gen[R, A])(test: A => TestResult): URIO[R, TestResult]

Checks the test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

Checks the test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

def checkAll[R <: TestConfig, A, B](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => TestResult): URIO[R, TestResult]

A version of checkAll that accepts two random variables.

A version of checkAll that accepts two random variables.

def checkAll[R <: TestConfig, A, B, C](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => TestResult): URIO[R, TestResult]

A version of checkAll that accepts three random variables.

A version of checkAll that accepts three random variables.

def checkAll[R <: TestConfig, A, B, C, D](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => TestResult): URIO[R, TestResult]

A version of checkAll that accepts four random variables.

A version of checkAll that accepts four random variables.

def checkAll[R <: TestConfig, A, B, C, D, F](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => TestResult): URIO[R, TestResult]

A version of checkAll that accepts five random variables.

A version of checkAll that accepts five random variables.

def checkAll[R <: TestConfig, A, B, C, D, F, G](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => TestResult): URIO[R, TestResult]

A version of checkAll that accepts six random variables.

A version of checkAll that accepts six random variables.

def checkAll[R <: TestConfig, R1 <: R, A, B, C, D, F, G, H](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => TestResult): URIO[R1, TestResult]

A version of checkAll that accepts seven random variables.

A version of checkAll that accepts seven random variables.

def checkAll[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G, H, I](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => TestResult): URIO[R1, TestResult]

A version of checkAll that accepts height random variables.

A version of checkAll that accepts height random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A](rv: Gen[R, A])(test: A => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

Checks the effectual test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

Checks the effectual test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts two random variables.

A version of checkAllM that accepts two random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts three random variables.

A version of checkAllM that accepts three random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C, D](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts four random variables.

A version of checkAllM that accepts four random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C, D, F](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts five random variables.

A version of checkAllM that accepts five random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts six random variables.

A version of checkAllM that accepts six random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G, H](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts seven random variables.

A version of checkAllM that accepts seven random variables.

def checkAllM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G, H, I](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllM that accepts height random variables.

A version of checkAllM that accepts height random variables.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A](rv: Gen[R, A], parallelism: Int)(test: A => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

Checks in parallel the effectual test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

Checks in parallel the effectual test passes for all values from the given random variable. This is useful for deterministic Gen that comprehensively explore all possibilities in a given domain.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A, B](rv1: Gen[R, A], rv2: Gen[R, B], parallelism: Int)(test: (A, B) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllMPar that accepts two random variables.

A version of checkAllMPar that accepts two random variables.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A, B, C](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], parallelism: Int)(test: (A, B, C) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllMPar that accepts three random variables.

A version of checkAllMPar that accepts three random variables.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A, B, C, D](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], parallelism: Int)(test: (A, B, C, D) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllMPar that accepts four random variables.

A version of checkAllMPar that accepts four random variables.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A, B, C, D, F](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], parallelism: Int)(test: (A, B, C, D, F) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllMPar that accepts five random variables.

A version of checkAllMPar that accepts five random variables.

def checkAllMPar[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], parallelism: Int)(test: (A, B, C, D, F, G) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkAllMPar that accepts six random variables.

A version of checkAllMPar that accepts six random variables.

def checkM[R <: TestConfig, R1 <: R, E, A](rv: Gen[R, A])(test: A => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

Checks the effectual test passes for "sufficient" numbers of samples from the given random variable.

Checks the effectual test passes for "sufficient" numbers of samples from the given random variable.

def checkM[R <: TestConfig, R1 <: R, E, A, B](rv1: Gen[R, A], rv2: Gen[R, B])(test: (A, B) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts two random variables.

A version of checkM that accepts two random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C])(test: (A, B, C) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts three random variables.

A version of checkM that accepts three random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C, D](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D])(test: (A, B, C, D) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts four random variables.

A version of checkM that accepts four random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C, D, F](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F])(test: (A, B, C, D, F) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts five random variables.

A version of checkM that accepts five random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G])(test: (A, B, C, D, F, G) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts six random variables.

A version of checkM that accepts six random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G, H](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H])(test: (A, B, C, D, F, G, H) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts seven random variables.

A version of checkM that accepts seven random variables.

def checkM[R <: TestConfig, R1 <: R, E, A, B, C, D, F, G, H, I](rv1: Gen[R, A], rv2: Gen[R, B], rv3: Gen[R, C], rv4: Gen[R, D], rv5: Gen[R, F], rv6: Gen[R, G], rv7: Gen[R, H], rv8: Gen[R, I])(test: (A, B, C, D, F, G, H, I) => ZIO[R1, E, TestResult]): ZIO[R1, E, TestResult]

A version of checkM that accepts height random variables.

A version of checkM that accepts height random variables.

def checkN(n: Int): CheckN

Checks the test passes for the specified number of samples from the given random variable.

Checks the test passes for the specified number of samples from the given random variable.

Checks the effectual test passes for the specified number of samples from the given random variable.

Checks the effectual test passes for the specified number of samples from the given random variable.

def failed[E](cause: Cause[E]): ZIO[Any, TestFailure[E], Nothing]

Creates a failed test result with the specified runtime cause.

Creates a failed test result with the specified runtime cause.

def platformSpecific[R, E, A](js: => A, jvm: => A)(f: A => ZTest[R, E]): ZTest[R, E]

Passes platform specific information to the specified function, which will use that information to create a test. If the platform is neither ScalaJS nor the JVM, an ignored test result will be returned.

Passes platform specific information to the specified function, which will use that information to create a test. If the platform is neither ScalaJS nor the JVM, an ignored test result will be returned.

def suite[R, E, T](label: String)(specs: Spec[R, E, T]*): Spec[R, E, T]

Builds a suite containing a number of other specs.

Builds a suite containing a number of other specs.

def suiteM[R, E, T](label: String)(specs: ZIO[R, E, Iterable[Spec[R, E, T]]]): Spec[R, E, T]

Builds an effectual suite containing a number of other specs.

Builds an effectual suite containing a number of other specs.

def test(label: String)(assertion: => TestResult)(implicit loc: SourceLocation): ZSpec[Any, Nothing]

Builds a spec with a single pure test.

Builds a spec with a single pure test.

def testM[R, E](label: String)(assertion: => ZIO[R, E, TestResult])(implicit loc: SourceLocation): ZSpec[R, E]

Builds a spec with a single effectful test.

Builds a spec with a single effectful test.

def versionSpecific[R, E, A](dotty: => A, scala2: => A)(f: A => ZTest[R, E]): ZTest[R, E]

Passes version specific information to the specified function, which will use that information to create a test. If the version is neither Dotty nor Scala 2, an ignored test result will be returned.

Passes version specific information to the specified function, which will use that information to create a test. If the version is neither Dotty nor Scala 2, an ignored test result will be returned.

Inherited methods

inline def assert[A](inline value: => A)(inline assertion: Assertion[A]): TestResult
Inherited from:
CompileVariants
inline def assertM[R, E, A](effect: ZIO[R, E, A])(assertion: AssertionM[A]): ZIO[R, E, TestResult]
Inherited from:
CompileVariants
inline def assertTrue(inline exprs: => Boolean*): Assert
Inherited from:
CompileVariants
inline def typeCheck(inline code: String): UIO[Either[String, Unit]]

Returns either Right if the specified string type checks as valid Scala code or Left with an error message otherwise. Dies with a runtime exception if specified string cannot be parsed or is not a known value at compile time.

Returns either Right if the specified string type checks as valid Scala code or Left with an error message otherwise. Dies with a runtime exception if specified string cannot be parsed or is not a known value at compile time.

Inherited from:
CompileVariants

Concrete fields

Asserts that the given test was completed.

Asserts that the given test was completed.

Asserts that the given test was completed.

Asserts that the given test was completed.

val defaultTestRunner: TestRunner[TestEnvironment, Any]

A Runner that provides a default testable environment.

A Runner that provides a default testable environment.

Creates an ignored test result.

Creates an ignored test result.

Implicits

Implicits

final implicit def SmartAssertionOps[A](self: A): SmartAssertionOps[A]
final implicit def TestLensAnyOps[A](self: TestLens[A]): TestLensAnyOps[A]
final implicit def TestLensCauseOps[E](self: TestLens[Cause[E]]): TestLensCauseOps[E]
final implicit def TestLensEitherOps[E, A](self: TestLens[Either[E, A]]): TestLensEitherOps[E, A]
final implicit def TestLensExitOps[E, A](self: TestLens[Exit[E, A]]): TestLensExitOps[E, A]
final implicit def TestLensOptionOps[A](self: TestLens[Option[A]]): TestLensOptionOps[A]