kotest-core / io.kotest.core.spec.style / AnnotationSpec

AnnotationSpec

abstract class AnnotationSpec : Spec

Annotations

After

Marks a function to be executed after each test

annotation class After

AfterAll

Marks a function to be executed after each spec

annotation class AfterAll

AfterClass

Marks a function to be executed after each spec

annotation class AfterClass

AfterEach

Marks a function to be executed after each test

annotation class AfterEach

Before

Marks a function to be executed before each test

annotation class Before

BeforeAll

Marks a function to be executed before each spec

annotation class BeforeAll

BeforeClass

Marks a function to be executed before each spec

annotation class BeforeClass

BeforeEach

Marks a function to be executed before each test

annotation class BeforeEach

Ignore

Marks a Test to be ignored

annotation class Ignore

Test

Marks a function to be executed as a Test

annotation class Test

Constructors

<init>

AnnotationSpec()

Functions

afterSpec

open fun afterSpec(spec: Spec): Unit

afterTest

open fun afterTest(testCase: TestCase, result: TestResult): Unit

beforeSpec

open fun beforeSpec(spec: Spec): Unit

beforeTest

open fun beforeTest(testCase: TestCase): Unit

Extension Functions

autoClose

Register an AutoCloseable so that it's close methods is automatically invoked when the tests are completed.

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

focusTests

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

fun Spec.focusTests(): List<TestCase>

invokeAfterSpec

Notifies the user listeners that a Spec has finished. This will be invoked for every instance of a spec.

suspend fun Spec.invokeAfterSpec(): Try<Spec>

invokeBeforeSpec

Notifies the user listeners that a Spec is starting. This will be invoked for every instance of a spec.

suspend fun Spec.invokeBeforeSpec(): Try<Spec>

materializeRootTests

Returns the root tests from this Spec and any included factories. The returned list will be ordered according to the TestCaseOrder returned by project config, or if not defined, the kotest default.

fun Spec.materializeRootTests(): List<RootTest>

resolvedAssertionMode

fun Spec.resolvedAssertionMode(): AssertionMode

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