kotest-core / io.kotest.core.spec

Package io.kotest.core.spec

Types

AfterProject

typealias AfterProject = () -> Unit

AfterSpec

typealias AfterSpec = suspend (Spec) -> Unit

AfterTest

typealias AfterTest = suspend (Tuple2<TestCase, TestResult>) -> Unit

AroundSpecFn

typealias AroundSpecFn = suspend (Tuple2<KClass<out Spec>, suspend () -> Unit>) -> Unit

AroundTestFn

typealias AroundTestFn = suspend (Tuple2<TestCase, suspend (TestCase) -> TestResult>) -> TestResult

AutoCloseable

interface AutoCloseable

BeforeSpec

typealias BeforeSpec = suspend (Spec) -> Unit

BeforeTest

typealias BeforeTest = suspend (TestCase) -> Unit

CompositeSpec

abstract class CompositeSpec : Spec

FailureFirstSpecExecutionOrder

An implementation of SpecExecutionOrder which will run specs that contained a failed test on a previous run first, before specs where all the tests passed.

object FailureFirstSpecExecutionOrder : SpecExecutionOrder

FinalizeSpec

typealias FinalizeSpec = suspend (Tuple2<KClass<out Spec>, Map<TestCase, TestResult>>) -> Unit

IsolationMode

enum class IsolationMode

LexicographicSpecExecutionOrder

An implementation of SpecExecutionOrder which will run specs in a lexicographic order.

object LexicographicSpecExecutionOrder : SpecExecutionOrder

PrepareSpec

typealias PrepareSpec = suspend (KClass<out Spec>) -> Unit

RandomSpecExecutionOrder

An implementation of SpecExecutionOrder which will run specs in a different random order each time the are executed.

object RandomSpecExecutionOrder : SpecExecutionOrder

Spec

abstract class Spec : TestConfiguration, SpecConfigurationMethods

SpecConfigurationMethods

Contains methods which can be overriden to set config in the same way that KotlinTest 3.x allowed. The preferred style is to call the DSL functions from within the tests but these methods are still supported and will not be deprecated.

interface SpecConfigurationMethods

SpecDsl

interface SpecDsl

SpecExecutionOrder

Note: This has no effect on non-JVM targets.

interface SpecExecutionOrder

TestCaseExtensionFn

typealias TestCaseExtensionFn = suspend (Tuple2<TestCase, suspend (TestCase) -> TestResult>) -> TestResult

TestConfiguration

The parent of all configuration DSL objects and contains configuration methods common to both Spec and TestFactoryConfiguration implementations.

abstract class TestConfiguration

Annotations

AutoScan

annotation class AutoScan

DisplayName

annotation class DisplayName

DoNotParallelize

annotation class DoNotParallelize

JsTest

The annotation JsTest is intercepted by the kotlin.js framework adapter to generate tests. It is simply an alias to kotlin.test.Test on the JS target.

annotation class JsTest

Junit5EnabledIfSystemProperty

annotation class Junit5EnabledIfSystemProperty

Junit5TestFactory

annotation class Junit5TestFactory

Testable

annotation class Testable

Extensions for External Classes

kotlin.collections.List

kotlin.reflect.KClass

Properties

initializeRuntime

val initializeRuntime: <ERROR CLASS>

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>

createTestCase

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

focusTests

Returns the focused root tests for this Spec. A focused test is one whose name begins with "f:".

fun Spec.focusTests(): List<TestCase>

resolvedExtensions

fun Spec.resolvedExtensions(): List<Extension>

resolvedIsolationMode

fun Spec.resolvedIsolationMode(): IsolationMode

resolvedTestCaseOrder

fun Spec.resolvedTestCaseOrder(): TestCaseOrder

resolvedTestListeners

Returns the resolved listeners for a given Spec. That is, the listeners defined directly on the spec, listeners generated from the callback-dsl methods, and listeners defined in any included test factories.

fun Spec.resolvedTestListeners(): List<TestListener>

tempfile

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