public class TestContext
A class TestContext is used as the receiver of a closure that is associated with a class TestCase.
This allows the scope body to interact with the test engine, for instance, adding metadata
during a test, reporting that an error was raised, or notifying the discovery
of a nested scope.
class TestContext implements CoroutineScope, which allows test closures to launch coroutines
with the CoroutineContext provided by the test engine.
class TestContext,
class TestCase,
class TestContext,
CoroutineContext| Constructor and Description |
|---|
TestContext(kotlin.coroutines.CoroutineContext coroutineContext)
A
class TestContext is used as the receiver of a closure that is associated with a class TestCase.
This allows the scope body to interact with the test engine, for instance, adding metadata
during a test, reporting that an error was raised, or notifying the discovery
of a nested scope. |
| Modifier and Type | Method and Description |
|---|---|
Description |
description()
|
kotlin.coroutines.CoroutineContext |
getCoroutineContext() |
void |
invoke(java.lang.String $receiver,
kotlin.jvm.functions.Function2<? super io.kotlintest.TestContext,? super kotlin.coroutines.experimental.Continuation<? super kotlin.Unit>,? extends java.lang.Object> test) |
java.util.Map<java.lang.String,java.lang.Object> |
metaData()
Returns all the metadata associated with this
class TestContext |
void |
putMetaData(java.lang.String key,
java.lang.Object value)
Adds a value to this
class TestContext meta data. |
java.lang.Object |
registerTestCase(java.lang.String name,
Spec spec,
kotlin.jvm.functions.Function2<? super io.kotlintest.TestContext,? super kotlin.coroutines.experimental.Continuation<? super kotlin.Unit>,? extends java.lang.Object> test,
TestCaseConfig config,
TestType type,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Creates a new
class TestCase and then notifies the test runner of this nested test. |
java.lang.Object |
registerTestCase(TestCase testCase,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Notifies the test runner about a nested
class TestCase. |
public TestContext(kotlin.coroutines.CoroutineContext coroutineContext)
A class TestContext is used as the receiver of a closure that is associated with a class TestCase.
This allows the scope body to interact with the test engine, for instance, adding metadata
during a test, reporting that an error was raised, or notifying the discovery
of a nested scope.
class TestContext implements CoroutineScope, which allows test closures to launch coroutines
with the CoroutineContext provided by the test engine.
class TestContext,
class TestCase,
class TestContext,
CoroutineContextpublic void invoke(java.lang.String $receiver,
kotlin.jvm.functions.Function2<? super io.kotlintest.TestContext,? super kotlin.coroutines.experimental.Continuation<? super kotlin.Unit>,? extends java.lang.Object> test)
public void putMetaData(java.lang.String key,
java.lang.Object value)
Adds a value to this class TestContext meta data.
class TestContextpublic java.util.Map<java.lang.String,java.lang.Object> metaData()
Returns all the metadata associated with this class TestContext
class TestContextpublic Description description()
Returns the class Description of the class TestCase that is attached to this class TestContext.
class Description,
class TestCase,
class TestContextpublic java.lang.Object registerTestCase(java.lang.String name,
Spec spec,
kotlin.jvm.functions.Function2<? super io.kotlintest.TestContext,? super kotlin.coroutines.experimental.Continuation<? super kotlin.Unit>,? extends java.lang.Object> test,
TestCaseConfig config,
TestType type,
kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Creates a new class TestCase and then notifies the test runner of this nested test.
class TestCasepublic java.lang.Object registerTestCase(TestCase testCase, kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Notifies the test runner about a nested class TestCase.
class TestCasepublic kotlin.coroutines.CoroutineContext getCoroutineContext()