Ignored¶
object Ignored : TestConfig.Element, TestConfig.Key.Unique<Ignored>
Marks a test or an entire suite as disabled.
Example¶
Mark a suite as disabled:
Mark a test as disabled:
See also¶
Ignored.If: Conditionally ignore a test or suite.
Properties¶
coroutineContext¶
The coroutine context configured for this test through the Context configuration.
Note that this is different from the coroutine context actually used to run tests; the value returned by this method contains the context declared in the config, whereas more elements are injected by the test machinery when the test actually starts.
key¶
The identifier for this test configuration element.
uniqueness¶
open override val uniqueness: TestConfig.Uniqueness.Unique
Marker for the uniqueness of the elements denoted by this key.
-
If
Uniqueness.Uniqueis used, a single element for a given key may be present. -
If
Uniqueness.Multiis used, multiple elements for the same key may be present.
Functions¶
get¶
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Unique>): E?
Finds the Element identified by key in the current TestConfig.
It's not possible for multiple elements to share a key marked with Uniqueness.Unique, so this function can never return multiple results. However, no elements may be identified by a key, in which case null is returned.
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Multi>): List<E>
Finds the elements identified by key in the current TestConfig.
Keys marked with Uniqueness.Multi allow multiple elements of the same type, so this function returns a list. If no elements are found, the returned list is empty.
If¶
inline fun If(predicate: () -> Boolean): TestConfig
Marks this test or an entire suite as disabled if predicate returns true.
If predicate returns false, does nothing.
Example¶
Mark a suite as disabled:
Mark a test as disabled:
Use-case¶
Conceptually, marking a test as ignored:
is similar to not declaring the test at all:
However, some test runners (e.g., TestBalloon) refuse to execute suites that are declared without any tests. Declaring tests as conditionally ignored avoids this issue.
See also
plus¶
operator fun TestConfig.plus(other: TestConfig): TestConfig
Combines two TestConfig instances.
The elements of other always override or combine with the elements with the same key from the receiver (depending on the Key.uniqueness).