Skip to content

KotestSuiteDsl

class KotestSuiteDsl : AbstractTestScope, SuiteDsl

An implementation of Prepared's SuiteDsl that is recognized by the Kotest IntelliJ plugin.

To create an instance of this class, use PreparedSpec.suite or preparedSuite.

Types

Companion

object Companion

Properties

coroutineContext

open override val coroutineContext: CoroutineContext

testCase

open override val testCase: TestCase

Functions

registerTest

open suspend override fun registerTest(test: TestDefinition)

registerTestCase

open suspend override fun registerTestCase(nested: NestedTest)

suite

@JvmName(name = "suiteKotest")
fun suite(
    name: String, 
    config: TestConfig = TestConfig.Empty, 
    block: KotestSuiteDsl.() -> Unit
)

Creates a child suite named name of the current suite.

Simple example

suite("An example") {
    test("A test") {  }

    suite("A nested suite") {
        test("A nested test 1") {  }
        test("A nested test 2") {  }
    }
}

Test configuration

The default configuration for all tests can be passed with the config parameter:

suite("An example", CoroutineTimeout(2.minutes) + Tag("slow")) {
    
}

To learn more about the available configuration options, see the subtypes of TestConfig.Element.

test

open override fun test(
    name: String, 
    config: TestConfig, 
    block: suspend TestDsl.() -> Unit
)