PreparedSpec¶
abstract class PreparedSpec(body: SuiteDsl.() -> Unit) : StringSpec
Constructors¶
PreparedSpec¶
Properties¶
assertionMode¶
var assertionMode: AssertionMode?
assertions¶
var assertions: AssertionMode?
assertSoftly¶
var assertSoftly: Boolean?
blockingTest¶
var blockingTest: Boolean?
coroutineDebugProbes¶
var coroutineDebugProbes: Boolean?
coroutineDispatcherFactory¶
var coroutineDispatcherFactory: CoroutineDispatcherFactory?
coroutineTestScope¶
var coroutineTestScope: Boolean?
defaultTestConfig¶
var defaultTestConfig: DefaultTestConfig?
duplicateTestNameMode¶
var duplicateTestNameMode: DuplicateTestNameMode?
extensions¶
open val extensions: List<Extension>
failfast¶
invocationTimeout¶
var invocationTimeout: Long?
isolationMode¶
var isolationMode: IsolationMode?
nonDeterministicTestVirtualTimeEnabled¶
@KotestInternal
var nonDeterministicTestVirtualTimeEnabled: Boolean
retries¶
retryDelay¶
var retryDelay: Duration?
scope¶
@ExperimentalKotest
lateinit var scope: CoroutineScope
severity¶
var severity: TestCaseSeverityLevel?
testCaseOrder¶
var testCaseOrder: TestCaseOrder?
testExecutionMode¶
var testExecutionMode: TestExecutionMode?
testOrder¶
var testOrder: TestCaseOrder?
timeout¶
Functions¶
add¶
open override fun add(test: RootTest)
afterAny¶
fun afterAny(f: AfterAny)
open suspend fun afterAny(testCase: TestCase, result: TestResult)
afterContainer¶
fun afterContainer(f: AfterContainer)
open suspend fun afterContainer(testCase: TestCase, result: TestResult)
afterEach¶
fun afterEach(f: AfterEach)
open suspend fun afterEach(testCase: TestCase, result: TestResult)
afterInvocation¶
fun afterInvocation(f: AfterInvocation)
afterProject¶
fun afterProject(f: AfterProject)
afterSpec¶
open suspend fun afterSpec(spec: Spec)
override fun afterSpec(f: AfterSpec)
afterTest¶
override fun afterTest(f: AfterTest)
open suspend fun afterTest(testCase: TestCase, result: TestResult)
aroundTest¶
fun aroundTest(aroundTestFn: AroundTestFn)
assertionMode¶
open fun assertionMode(): AssertionMode?
autoClose¶
autoCloseables¶
fun autoCloseables(): List<Lazy<AutoCloseable>>
beforeAny¶
fun beforeAny(f: BeforeAny)
open suspend fun beforeAny(testCase: TestCase)
beforeContainer¶
fun beforeContainer(f: BeforeContainer)
open suspend fun beforeContainer(testCase: TestCase)
beforeEach¶
fun beforeEach(f: BeforeEach)
open suspend fun beforeEach(testCase: TestCase)
beforeInvocation¶
fun beforeInvocation(f: BeforeInvocation)
beforeSpec¶
fun beforeSpec(f: BeforeSpec)
open suspend fun beforeSpec(spec: Spec)
beforeTest¶
open suspend fun beforeTest(testCase: TestCase)
override fun beforeTest(f: BeforeTest)
config¶
open fun String.config(
enabled: Boolean?,
invocations: Int?,
threads: Int?,
tags: Set<Tag>?,
timeout: Duration?,
extensions: List<TestCaseExtension>?,
enabledIf: EnabledIf?,
invocationTimeout: Duration?,
severity: TestCaseSeverityLevel?,
enabledOrReasonIf: EnabledOrReasonIf?,
coroutineDebugProbes: Boolean?,
blockingTest: Boolean?,
coroutineTestScope: Boolean?,
test: suspend TestScope.() -> Unit
)
coroutineDispatcherFactory¶
open fun coroutineDispatcherFactory(): CoroutineDispatcherFactory?
duplicateTestNameMode¶
open fun duplicateTestNameMode(): DuplicateTestNameMode?
extension¶
fun extension(f: TestCaseExtensionFn)
extensions¶
fun extensions(): List<Extension>
fun extensions(vararg extensions: Extension)
fun extensions(extensions: List<Extension>)
include¶
fun include(factory: TestFactory)
invocationTimeout¶
open fun invocationTimeout(): Long?
invoke¶
isolationMode¶
open fun isolationMode(): IsolationMode?
preparedSuite¶
fun RootScope.preparedSuite(config: TestConfig = TestConfig.Empty, block: SuiteDsl.() -> Unit)
Executes a Prepared SuiteDsl in a Kotest suite.
Since Kotest cannot represent nested non-suspending test suites, all nested suites are declared at the top-level of the provided RootScope. The name of the suite is appended at the start of the tests, so the suite structure is not lost.
Example¶
This example uses StringSpec, but tests can be registered using any spec.
register¶
registeredAutoCloseables¶
fun registeredAutoCloseables(): List<Lazy<AutoCloseable>>
rootTests¶
seal¶
fun seal()
tags¶
open override fun tags(vararg tags: Tag)
testCaseOrder¶
open fun testCaseOrder(): TestCaseOrder?
testExecutionMode¶
open fun testExecutionMode(): TestExecutionMode?