Sign in Go Pro

Android MvRx Fundamentals

Test ViewModels

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Previous

About

Testing ViewModels is nearly as easy as testing state. In MvRx, all dependencies are constructor injected and ViewModels only have one lifecycle method (onCleared). To test ViewModels, just pass in implementations or mocks of your dependencies into your constructor, call functions on your ViewModel that affect state, and run assertions that your state was updated correctly.

This lesson will guide in configuring the mvrx-testing artifact which will ensure that your MvRx reducers run synchronously and will write a few tests for a MvRxViewModel.

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Android MvRx Fundamentals