Testing Android Flows in ViewModel with Turbine
<p>As it is common now, the correct architecture should contain decoupled layers. Inter-layer communication between them is done by streams, or in our case, flows, in Android. To make our solutions foolproof, we should create tests around every component, and the ViewModel is no exception. The more channels the ViewModel contains, the more challenging is to assert its complexity of it. The states should be emitted in a controlled way rather than in a chaotic.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/0*Vh9IsAi4W_UMgeus" style="height:525px; width:700px" /></p>
<p>Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&utm_medium=referral" rel="noopener ugc nofollow" target="_blank">Brett Jordan</a> on <a href="https://unsplash.com/?utm_source=medium&utm_medium=referral" rel="noopener ugc nofollow" target="_blank">Unsplash</a></p>
<h1>Set up</h1>
<p>Everything will be done without instrumentation tests, so the phone does not need to be connected.</p>
<p><a href="https://proandroiddev.com/testing-android-flows-in-viewmodel-with-turbine-ea9bae7e811a"><strong>Visit Now</strong></a></p>