or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cross-platform.mdevent-reporting.mdframework.mdindex.mdtask-execution.md
tile.json

tessl/maven-dev-zio--zio-test-sbt-2-13

SBT test framework integration for ZIO Test that enables ZIO's functional testing framework to be executed within SBT builds

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/dev.zio/zio-test-sbt_2.13@1.0.x

To install, run

npx @tessl/cli install tessl/maven-dev-zio--zio-test-sbt-2-13@1.0.0

index.mddocs/

ZIO Test SBT Integration

ZIO Test SBT is a test framework integration that enables ZIO Test specifications to be executed by SBT. It provides cross-platform support for JVM, JavaScript, and Native environments, allowing ZIO's functional testing framework to integrate seamlessly with SBT's testing infrastructure.

Package Information

  • Package Name: zio-test-sbt
  • Package Type: maven
  • Language: Scala
  • Organization: dev.zio
  • Installation: Add to build.sbt:
    libraryDependencies += "dev.zio" %% "zio-test-sbt" % "1.0.18" % Test

Core Imports

import zio.test.sbt._

For testing framework implementation:

import sbt.testing._
import zio.test.sbt.{ZTestFramework, ZTestRunner, SendSummary}

Basic Usage

ZIO Test SBT is primarily used by SBT internally for test execution. To enable it in your project:

  1. Add the dependency to your build.sbt
  2. Configure the test framework:
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
  1. Create ZIO Test specifications as usual:
import zio.test._

object MySpec extends DefaultRunnableSpec {
  def spec = suite("My Tests")(
    test("example test") {
      assert(1 + 1)(equalTo(2))
    }
  )
}

Architecture

ZIO Test SBT consists of several key components:

  • Framework Integration: ZTestFramework implements SBT's Framework interface for test discovery
  • Task Execution: BaseTestTask and platform-specific implementations handle test execution
  • Event System: ZTestEvent reports test results back to SBT
  • Cross-Platform Support: Separate implementations for JVM, JavaScript, and Native platforms

Capabilities

Framework Integration

Core SBT test framework implementation that enables test discovery and execution.

class ZTestFramework extends Framework {
  val name: String
  val fingerprints: Array[Fingerprint]
  def runner(args: Array[String], remoteArgs: Array[String], testClassLoader: ClassLoader): Runner
}

Framework Integration

Task Execution

Base task execution capabilities for running ZIO Test specifications within SBT.

abstract class BaseTestTask(
  taskDef: TaskDef,
  testClassLoader: ClassLoader, 
  sendSummary: SendSummary,
  args: TestArgs
) extends Task {
  def execute(eventHandler: EventHandler, loggers: Array[Logger]): Array[Task]
}

Task Execution

Event Reporting

Test event generation and reporting system for SBT integration.

case class ZTestEvent(
  fullyQualifiedName: String,
  selector: Selector,
  status: Status,
  maybeThrowable: Option[Throwable],
  duration: Long,
  fingerprint: Fingerprint
) extends Event

Event Reporting

Cross-Platform Support

Platform-specific implementations for JVM, JavaScript, and Native environments.

// Platform-specific runners
class ZMasterTestRunner extends ZTestRunner
class ZSlaveTestRunner extends ZTestRunner  

// Summary serialization for JS/Native
object SummaryProtocol {
  def serialize(summary: Summary): String
  def deserialize(s: String): Option[Summary]
}

Cross-Platform Support

Types

Core Types

// Summary sending effect
type SendSummary = URIO[Summary, Unit]

// Task policy for merging tasks
abstract class ZTestTaskPolicy {
  def merge(zioTasks: Array[ZTestTask]): Array[Task]
}

// Test discovery fingerprint
object RunnableSpecFingerprint extends SubclassFingerprint {
  def superclassName(): String
  def isModule(): Boolean  
  def requireNoArgConstructor(): Boolean
}

Platform-Specific Types

JavaScript and Native platforms include additional types for distributed execution and serialization that are not available on the JVM platform.