Integrate test dispatchers with libraries using Dispatchers.Xxx
See original GitHub issue
Top Results From Across the Web
Possibility to replace default dispatchers · Issue #810 - GitHub
Replacing dispatcher implementation is pretty common thing which of course ... Integrate test dispatchers with libraries using Dispatchers.
Read more >Set up local Dispatcher Tools - AEM
AEM SDK's Dispatcher Tools facilitates the local development of Adobe Experience Manager (AEM) projects by making it easy to install, ...
Read more >Testing support - Spring
The Spring Integration Test Framework and test utilities are fully based on existing JUnit, Hamcrest, and Mockito libraries. The application context interaction ...
Read more >Use Kotlin Coroutines in your Android App - Android Developers
This exercise shows you how to test coroutines running on Dispatchers. Main using the kotlinx-coroutines-test library. Later in this codelab ...
Read more >How could I write tests for uncovered lines in useEffect and ...
I succeeded in writing the test : adding inputProps={{ id: "trimInput" }} to ... /></Provider>); store.dispatch = jest.fn(); await act(async ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any update on this issue ?
We do have retry handling and other code that needs to work around limitations of underlying libraries with
delay
and those can happen inside non-Main dispatchers. It would be really great to have the possibility to not just set the main dispatcher but really all dispatchers. Currently we still depend on a wrapper (e.g.dispatchers.io
instead ofDispatchers.IO
) to have full control and a well-defined test environment. Does anything speak against just providing a simpleDispatchers.setAll(dispatcher)
?Also, it would be really awesome to have some utility to make setting up coroutine-capable unit tests trivially easy. Ideally, the default behavior in unit tests would automatically switch all dispatchers and the test lib would provide a global singleton default
testScope
. If anyone needs more control it’s still possible to modify the default setup and use custom testScopes.If having nice default behavior automatically is impossible, then it would be great to have something like a CoroutineTest base class or delegate or a test rule that can be added to any existing test class in as little code as possible to get the nice defaults. Anything that doesn’t require repeating that boilerplate and learning unnecessary details just to get started would be great.