Skip to content

Document how to use runTest instead of runBlocking for Kotlin coroutine tests #4768

@JavierSegoviaCordoba

Description

@JavierSegoviaCordoba

Context, this GitHub comment and the ones below it: #1914 (comment)

Furthermore, if suspend tests use runTest, it would be amazing to support specifying a dispatcher via an annotation:

@TestDispatcher(FooDispatcher::class)
class BarTest {

    ...
}

I find it weird to need to replace the dispatcher only on a single test instead of the whole class. @TestDispatcher(FooDispatcher::class) should work if it is also annotating a test method for that use case.

Metadata

Metadata

Type

No fields configured for Task.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions