Lines Matching full:runtest
11 | [runTest] | Runs the test code, automatically skipping delays and handling uncaught exceptions. |
13 | [TestScope] | A [CoroutineScope] that integrates with [runTest], providing access to [TestCorouti…
80 ## runTest section in Module kotlinx-coroutines-test
82 [runTest] is the way to test code that involves coroutines. `suspend` functions can be called insid…
84 **IMPORTANT: in order to work with on Kotlin/JS, the result of `runTest` must be immediately `retur…
85 The typical invocation of [runTest] thus looks like this:
89 fun testFoo() = runTest {
99 return runTest {
105 [runTest] is similar to running the code with `runBlocking` on Kotlin/JVM and Kotlin/Native, or lau…
118 …[runTest] will handle the situations where some code runs in dispatchers not integrated with the t…
126 fun testHanging() = runTest {
136 fun testTakingALongTime() = runTest(timeout = 30.seconds) {
147 To test regular suspend functions, which may have a delay, just run them inside the [runTest] block.
151 fun testFoo() = runTest { // a coroutine with an extra test control
157 delay(1_000) // when run in `runTest`, will finish immediately instead of delaying
164 …patcher used for tests is single-threaded, meaning that the child coroutines of the [runTest] block
172 fun testWithMultipleDelays() = runTest {
193 Inside [runTest], the execution is scheduled by [TestCoroutineScheduler], which is a virtual time s…
203 fun testFoo() = runTest {
238 fun testWithMultipleDispatchers() = runTest {
260 **Note: if [Dispatchers.Main] is replaced by a [TestDispatcher], [runTest] will automatically use i…
261 …o that there is no need to go through the ceremony of passing the correct scheduler to [runTest].**
267 for [runTest] and used as the receiver for the test body.
277 Therefore, it is important to ensure that [TestScope.runTest] is called eventually.
295 fun testSubject() = scope.runTest {
302 Sometimes, the fact that [runTest] waits for all the coroutines to finish is undesired.
304 Emulating such coroutines by launching them from the test body is not sufficient, because [runTest]…
312 fun testExampleBackgroundJob() = runTest {
333 If [runTest] executes with an [UnconfinedTestDispatcher], the child coroutines launched at the top …
338 fun testEagerlyEnteringChildCoroutines() = runTest(UnconfinedTestDispatcher()) {
359 fun testEagerlyEnteringSomeChildCoroutines() = runTest(UnconfinedTestDispatcher()) {
377 ### Using `withTimeout` inside `runTest`
383 fun testFooWithTimeout() = runTest {
406 fun testExpensiveFunction() = runTest {
439 [runTest]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines…
448 [TestScope.runTest]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.…