Package-level declarations

Types

Link copied to clipboard

A test containing a test action which raises assertion errors on failure. The action may suspend.

Link copied to clipboard

Marker for an experimental TestBalloon API, which is not stable and may be changed or removed.

Link copied to clipboard
open class TestCompartment(name: String, testConfig: TestConfig) : TestSuite

A compartment isolating a number of tests from those belonging to other compartments.

Link copied to clipboard
open class TestConfig

A test element's configuration, modifying the execution of tests and suites.

Link copied to clipboard
Link copied to clipboard
sealed class TestElementEvent

An event occurring as part of a test element's setup or execution.

Link copied to clipboard
typealias TestElementExecutionWrappingAction = suspend TestElement.(elementAction: suspend TestElement.() -> Unit) -> Unit

An action wrapping a TestElement's execution.

Link copied to clipboard
abstract class TestExecutionReport

A report containing a sequence of test events, each of which will be added during execution.

Link copied to clipboard
class TestExecutionScope : AbstractTest, CoroutineScope
Link copied to clipboard

A traversal following the execution across all TestElements of a (partial) test element hierarchy.

Link copied to clipboard

The mode in which a TestSuite executes its child TestElements.

Link copied to clipboard

The permit to accept a situation which would otherwise trigger an error in TestBalloon.

Link copied to clipboard
interface TestPlatform

The platform executing tests.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A compilation module's root test suite, holding the module-wide default configuration.

Link copied to clipboard

A test suite containing child TestElements (tests and/or suites). A suite may not contain test logic.

Link copied to clipboard
typealias TestSuiteExecutionWrappingAction = suspend (testSuiteAction: suspend TestSuite.() -> Unit) -> Unit

An action wrapping the actions of a TestSuite.

Properties

Link copied to clipboard

The JUnit 4 description for this Test.

Link copied to clipboard

The TestPlatform currently used to execute tests.

Functions

Link copied to clipboard

Returns a test configuration which adds permits for all TestSuites of a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which wraps executionWrappingAction around a single test element.

Link copied to clipboard

Returns a test configuration which wraps executionWrappingAction around each element of a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which wraps executionWrappingAction around each Test of a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which wraps a coroutine context around the TestElement's execution.

Link copied to clipboard

Returns a test configuration which disables test execution for a TestElement hierarchy.

Link copied to clipboard
actual fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher
expect fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher

Returns a CoroutineDispatcher providing a maximum amount of parallelism, limited by the platform's capabilities.

actual fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher
actual fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher
actual fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher
actual fun dispatcherWithParallelism(parallelism: Int): CoroutineDispatcher
Link copied to clipboard

Returns a test configuration which adds a TestExecutionReport to a test element hierarchy.

Link copied to clipboard
fun TestConfig.failFast(maxFailureCount: Int): TestConfig

Returns a test configuration which establishes a "fail fast" strategy on a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which specifies an invocation mode for all TestSuites of a TestElement hierarchy.

Link copied to clipboard
fun TestConfig.mainDispatcher(dispatcher: CoroutineDispatcher? = null): TestConfig

Returns a test configuration which specifies a main dispatcher (Dispatchers.setMain) for a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which specifies a set of permits for all TestSuites of a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which removes permits for all TestSuites of a TestElement hierarchy.

Link copied to clipboard

Returns a test configuration which wraps a single-threaded dispatcher around a TestElement's execution.

Link copied to clipboard
fun TestConfig.testScope(isEnabled: Boolean, timeout: Duration = 60.seconds): TestConfig

Returns a test configuration which enables/disables a kotlinx.coroutines.test.TestScope for a TestElement hierarchy.

Link copied to clipboard
fun testSuite(name: String = "", displayName: String = name, testConfig: TestConfig = TestConfig, content: TestSuite.() -> Unit): Lazy<TestSuite>
fun testSuite(name: String = "", displayName: String = name, compartment: () -> TestCompartment, testConfig: TestConfig = TestConfig, content: TestSuite.() -> Unit): Lazy<TestSuite>

Registers a top-level TestSuite.

Link copied to clipboard
fun <Rule : TestRule> TestSuite.testWithJUnit4Rule(name: String, rule: Rule, action: suspend (Rule) -> Unit)

Registers a Test wrapped by a JUnit 4 TestRule.

Link copied to clipboard

Returns a test configuration which applies a TestExecutionTraversal to each element of a TestElement hierarchy.

Link copied to clipboard
suspend fun withMainDispatcher(dispatcher: CoroutineDispatcher? = null, action: suspend () -> Unit)

Runs action with dispatcher set up as the main dispatcher, which will be reset afterward.

Link copied to clipboard
@ExperimentalCoroutinesApi
actual suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)
expect suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)

Executes action, providing it with a single-threaded CoroutineDispatcher.

actual suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)
actual suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)
actual suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)
actual suspend fun withSingleThreadedDispatcher(action: suspend (dispatcher: CoroutineDispatcher) -> Unit)