kotest-core / io.kotest.core.factory / TestFactoryConfiguration

TestFactoryConfiguration

abstract class TestFactoryConfiguration : TestConfiguration

A TestFactoryConfiguration provides a DSL to allow for easy creation of a TestFactory when this class is the receiver of a lambda parameter.

This class shouldn't be used directly, but as the base for a particular layout style, eg FunSpecTestFactoryConfiguration.

Constructors

<init>

A TestFactoryConfiguration provides a DSL to allow for easy creation of a TestFactory when this class is the receiver of a lambda parameter.

TestFactoryConfiguration()

Functions

addDynamicTest

Adds a new DynamicTest to this factory. When this factory is included into a Spec these tests will be added to the spec as root TestCases.

fun addDynamicTest(name: String, test: suspend TestContext.() -> Unit, config: TestCaseConfig, type: TestType): Unit

afterTest

Registers a new after-test callback to be executed after every TestCase. The callback provides two parameters - the test case that has just completed, and the TestResult outcome of that test.

open fun afterTest(f: AfterTest): Unit

beforeTest

Registers a new before-test callback to be executed before every TestCase. The TestCase about to be executed is provided as the parameter.

open fun beforeTest(f: BeforeTest): Unit

Extension Functions

autoClose

Closes an AutoCloseable when the spec is completed by registering an afterSpec listener which invokes the AutoCloseable.close method.

fun <T : AutoCloseable> TestConfiguration.autoClose(closeable: T): T

Closes a lazy AutoCloseable when the spec is completed by registering an afterSpec listener which invokes the AutoCloseable.close method.

fun <T : AutoCloseable> TestConfiguration.autoClose(closeable: Lazy<T>): Lazy<T>

build

Builds an immutable TestFactory from this configuration.

fun TestFactoryConfiguration.build(): TestFactory

tempfile

fun TestConfiguration.tempfile(prefix: String? = null, suffix: String? = ".tmp"): File

Inheritors

BehaviorSpecTestFactoryConfiguration

class BehaviorSpecTestFactoryConfiguration : TestFactoryConfiguration, BehaviorSpecDsl

DescribeSpecTestFactoryConfiguration

class DescribeSpecTestFactoryConfiguration : TestFactoryConfiguration, DescribeSpecDsl

ExpectSpecTestFactoryConfiguration

class ExpectSpecTestFactoryConfiguration : TestFactoryConfiguration, ExpectSpecDsl

FeatureSpecTestFactoryConfiguration

class FeatureSpecTestFactoryConfiguration : TestFactoryConfiguration, FeatureSpecDsl

FreeSpecTestFactoryConfiguration

class FreeSpecTestFactoryConfiguration : TestFactoryConfiguration, FreeSpecDsl

FunSpecTestFactoryConfiguration

class FunSpecTestFactoryConfiguration : TestFactoryConfiguration, FunSpecDsl

ShouldSpecTestFactoryConfiguration

class ShouldSpecTestFactoryConfiguration : TestFactoryConfiguration, ShouldSpecDsl

StringSpecTestFactoryConfiguration

Decorates a TestFactoryConfiguration with the StringSpec DSL.

class StringSpecTestFactoryConfiguration : TestFactoryConfiguration, StringSpecDsl

WordSpecTestFactoryConfiguration

Decorates a TestFactoryConfiguration with the WordSpec DSL.

class WordSpecTestFactoryConfiguration : TestFactoryConfiguration, WordSpecDsl