Lorenzo Testa
08/21/2019, 2:12 PMLiveData and Coroutines, so I'm not sure if this is the best channel for this question, but it seems to be more about coroutines. If I understand correctly for LiveData the best practice is to use the InstantTaskExecutorRule and for coroutines is to set as the main dispatcher a single thread executor before the test and reset it after. Now with this setup I can write correct tests while testing one or the other at a time, but I have a LiveData that is created from a Flow using the builder androidx.lifecycle.liveData that runs on the Main dispatcher. Now when I observe the LiveData the observer is not called instantly since even if the InstantTaskExecutorRule uses the current thread as main thread the updates run on the coroutines Main dispatcher which is another thread. Some suggestion on how to wait that all the updates are delivered to the observer? Also the Flow has also a onCompletion action registered and I need to wait that also that is executed.