Skip to content

TestExecutor

expect abstract class TestExecutor

Entrypoint to declare a SuiteDsl executed with kotlin-test.

Because `kotlin-test` doesn't provide a way to dynamically instantiate tests, we have to cheat. This class abstracts away our hacks to make it work. Please vote on [KT-46899](https://youtrack.jetbrains.com/issue/KT-46899).

Because of these hacks, implementing this class has strange requirements:

 - an implementation class's name must contain `Test`


### Example
```kotlin
class ExecuteTest : TestExecutor() {
    override fun Suite.register() {
        test("This is a test") {
            println("Hello world!")
        }
    }
}
```

actual abstract class TestExecutor
Entrypoint to declare a SuiteDsl executed with kotlin-test.

Because kotlin-test doesn't provide a way to dynamically instantiate tests, we have to cheat. This class abstracts away our hacks to make it work. Please vote on KT-46899.

Because of these hacks, implementing this class has strange requirements:

  • an implementation class's name must contain Test

Example

class ExecuteTest : TestExecutor() {
    override fun Suite.register() {
        test("This is a test") {
            println("Hello world!")
        }
    }
}

actual abstract class TestExecutor
Entrypoint to declare a SuiteDsl executed with kotlin-test.

Because kotlin-test doesn't provide a way to dynamically instantiate tests, we have to cheat. This class abstracts away our hacks to make it work. Please vote on KT-46899.

Because of these hacks, implementing this class has strange requirements:

  • an implementation class's name must contain Test

Example

class ExecuteTest : TestExecutor() {
    override fun Suite.register() {
        test("This is a test") {
            println("Hello world!")
        }
    }
}

Constructors

TestExecutor

constructor()
constructor()
expect constructor()

Properties

config

expect open val config: TestConfig

actual open val config: TestConfig

actual open val config: TestConfig

Default configuration for all tests registered in this class.

Default configuration for all tests registered in this class.

Default configuration for all tests registered in this class.

Functions

register

expect abstract fun SuiteDsl.register()

actual abstract fun SuiteDsl.register()

actual abstract fun SuiteDsl.register()

Declares a SuiteDsl which will be run with kotlin-test.

For more information, see the class-level documentation.

Declares a SuiteDsl which will be run with kotlin-test.

For more information, see the class-level documentation.

Declares a SuiteDsl which will be run with kotlin-test.

For more information, see the class-level documentation.

registerTests

suite

@TestFactory
fun suite(): Stream<out DynamicNode>