or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

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

framework.mddocs/

0

# Framework Integration

1

2

The framework integration provides the core SBT test framework implementation that enables test discovery and execution of ZIO Test specifications.

3

4

## ZTestFramework

5

6

The main test framework class that implements SBT's `Framework` interface.

7

8

```scala { .api }

9

class ZTestFramework extends Framework {

10

val name: String

11

val fingerprints: Array[Fingerprint]

12

def runner(args: Array[String], remoteArgs: Array[String], testClassLoader: ClassLoader): Runner

13

}

14

```

15

16

**Platform Variations:**

17

- **JVM**: Returns `ZTestRunner` instance

18

- **JavaScript/Native**: Also provides `slaveRunner()` method for distributed testing

19

20

### Properties

21

22

- `name` - Framework display name with ANSI styling: `"ZIO Test"`

23

- `fingerprints` - Array containing `RunnableSpecFingerprint` for test discovery

24

25

### Methods

26

27

#### runner()

28

29

Creates a test runner for the given arguments and class loader.

30

31

**Parameters:**

32

- `args: Array[String]` - Command line arguments passed to the test framework

33

- `remoteArgs: Array[String]` - Remote execution arguments

34

- `testClassLoader: ClassLoader` - Class loader for loading test classes

35

36

**Returns:** Platform-specific runner implementation

37

38

#### slaveRunner() (JavaScript/Native only)

39

40

Creates a slave runner for distributed test execution.

41

42

**Parameters:**

43

- `args: Array[String]` - Command line arguments

44

- `remoteArgs: Array[String]` - Remote execution arguments

45

- `testClassLoader: ClassLoader` - Test class loader

46

- `send: String => Unit` - Function to send serialized summaries to master

47

48

**Returns:** `ZSlaveTestRunner` instance

49

50

## Test Discovery

51

52

### RunnableSpecFingerprint

53

54

SBT fingerprint for discovering ZIO test specifications.

55

56

```scala { .api }

57

object RunnableSpecFingerprint extends SubclassFingerprint {

58

def superclassName(): String

59

def isModule(): Boolean

60

def requireNoArgConstructor(): Boolean

61

}

62

```

63

64

#### Methods

65

66

- `superclassName()` - Returns the fully qualified name of `AbstractRunnableSpec`

67

- `isModule()` - Returns `true` (ZIO specs are typically objects)

68

- `requireNoArgConstructor()` - Returns `false` (no constructor requirements)

69

70

## Usage Example

71

72

```scala

73

// SBT automatically uses the framework when configured

74

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

75

76

// The framework discovers and runs specs like:

77

object MySpec extends DefaultRunnableSpec {

78

def spec = suite("Tests")(

79

test("example") {

80

assert(42)(equalTo(42))

81

}

82

)

83

}

84

```

85

86

The framework automatically discovers test specifications that extend `AbstractRunnableSpec` and executes them through the SBT testing infrastructure.