PreparedSpec

abstract class PreparedSpec(body: PreparedSpec.() -> Unit, config: TestConfig = TestConfig.Empty) : AbstractSpec, SuiteDsl(source)

Declares a Prepared test suite using the Kotest framework.

Install the Kotest IntelliJ plugin to have gutter icons to run a specific test.

Example

class MyTest : PreparedSpec({
test("A regular test") {
// …
}

suite("A suite") {
test("Another test") {
// …
}
}
})

Constructors

Link copied to clipboard
constructor(body: PreparedSpec.() -> Unit, config: TestConfig = TestConfig.Empty)

Properties

Link copied to clipboard
var assertionMode: AssertionMode?
Link copied to clipboard
var assertions: AssertionMode?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var coroutineDispatcherFactory: CoroutineDispatcherFactory?
Link copied to clipboard
Link copied to clipboard
var defaultTestConfig: DefaultTestConfig?
Link copied to clipboard
var duplicateTestNameMode: DuplicateTestNameMode?
Link copied to clipboard
open val extensions: List<Extension>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var isolationMode: IsolationMode?
Link copied to clipboard
val metadata: TestMetadata
Link copied to clipboard
var retries: Int?
Link copied to clipboard
Link copied to clipboard
@ExperimentalKotest
@KotestInternal
lateinit var scope: CoroutineScope
Link copied to clipboard
var severity: TestCaseSeverityLevel?
Link copied to clipboard
var testCaseOrder: TestCaseOrder?
Link copied to clipboard
var testExecutionMode: TestExecutionMode?
Link copied to clipboard
var testOrder: TestCaseOrder?
Link copied to clipboard

Functions

Link copied to clipboard
open override fun add(test: RootTest)
open override fun add(test: TestDefinition)
Link copied to clipboard
fun afterAny(f: AfterAny)
open suspend fun afterAny(testCase: TestCase, result: TestResult)
Link copied to clipboard
fun afterContainer(f: AfterContainer)
open suspend fun afterContainer(testCase: TestCase, result: TestResult)
Link copied to clipboard
fun afterEach(f: AfterEach)
open suspend fun afterEach(testCase: TestCase, result: TestResult)
Link copied to clipboard
fun afterInvocation(f: AfterInvocation)
Link copied to clipboard
fun afterProject(f: AfterProject)
Link copied to clipboard
open suspend fun afterSpec(spec: Spec)
override fun afterSpec(f: AfterSpec)
Link copied to clipboard
override fun afterTest(f: AfterTest)
open suspend fun afterTest(testCase: TestCase, result: TestResult)
Link copied to clipboard
fun aroundTest(aroundTestFn: AroundTestFn)
Link copied to clipboard
open fun assertionMode(): AssertionMode?
Link copied to clipboard
fun <T : AutoCloseable> autoClose(closeable: T): T
fun <T : AutoCloseable> autoClose(closeable: Lazy<T>): Lazy<T>
Link copied to clipboard
fun autoCloseables(): List<Lazy<AutoCloseable>>
Link copied to clipboard
fun beforeAny(f: BeforeAny)
open suspend fun beforeAny(testCase: TestCase)
Link copied to clipboard
fun beforeContainer(f: BeforeContainer)
open suspend fun beforeContainer(testCase: TestCase)
Link copied to clipboard
fun beforeEach(f: BeforeEach)
open suspend fun beforeEach(testCase: TestCase)
Link copied to clipboard
fun beforeInvocation(f: BeforeInvocation)
Link copied to clipboard
fun beforeSpec(f: BeforeSpec)
open suspend fun beforeSpec(spec: Spec)
Link copied to clipboard
open suspend fun beforeTest(testCase: TestCase)
override fun beforeTest(f: BeforeTest)
Link copied to clipboard
open fun coroutineDispatcherFactory(): CoroutineDispatcherFactory?
Link copied to clipboard
open fun duplicateTestNameMode(): DuplicateTestNameMode?
Link copied to clipboard
fun extension(f: TestCaseExtensionFn)
fun <T : Extension> extension(extension: T): T
Link copied to clipboard
fun extensions(): List<Extension>
fun extensions(extensions: List<Extension>)
fun extensions(vararg extensions: Extension)
Link copied to clipboard
fun finalizeSpec(f: FinalizeSpec)
Link copied to clipboard
fun include(factory: TestFactory)
fun include(prefix: String, factory: TestFactory)
Link copied to clipboard
open fun invocationTimeout(): Long?
Link copied to clipboard
open fun isolationMode(): IsolationMode?
Link copied to clipboard
fun AbstractSpec.preparedSuite(config: TestConfig = TestConfig.Empty, block: KotestSuiteDsl.() -> Unit)

Executes a Prepared SuiteDsl in an existing Kotest suite.

Link copied to clipboard
fun <T : Extension> register(extension: T): T
Link copied to clipboard
fun registeredAutoCloseables(): List<Lazy<AutoCloseable>>
Link copied to clipboard
@JvmName(name = "suiteKotest")
fun suite(name: String, config: TestConfig = TestConfig.Empty, block: KotestSuiteDsl.() -> Unit)

Creates a child suite named name of the current suite.

Link copied to clipboard
open override fun tags(vararg tags: Tag)
open fun tags(): Set<Tag>
Link copied to clipboard
open override fun test(name: String, config: TestConfig, block: suspend TestDsl.() -> Unit)
open fun test(name: String, context: CoroutineContext, config: TestConfig, block: suspend TestDsl.() -> Unit)
Link copied to clipboard
open fun testCaseOrder(): TestCaseOrder?
Link copied to clipboard
open fun testExecutionMode(): TestExecutionMode?
Link copied to clipboard
open override fun tests(): List<TestDefinition>
Link copied to clipboard
open fun timeout(): Long?