How to MVVM Testing?

I would like to know how do you write MVVM testing on Android.

Do you face any challenges? Do you user unit test for model-view and model? And the Instrumented test for View? Do you have any repository with real examples of MVVM and testing? Does using Android ModelView Jetpack make it easy to write JVM unit test? Will raywenderlich post videos focusing on writing tests for MVVM Android?

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi Amadeu, thanks for the question!

We just finished recording an “MVVM for Android” video course that shows how to do Model and ViewModel JUnit unit testing, including using the Architecture Component ViewModel class from Jetpack. Look for that video course to be available in 1-2 weeks.

Also, you can check out our recent tutorial on Android TDD, in which Victoria Gonda shows you how to do ViewModel instrumentation testing while doing Test-Driven Development:

Both the video course and TDD tutorial include code examples where you can see testing within the Android sample projects.

Thanks again for the question!

1 Like

Thanks for your reply! I’m looking forwarding to see the MVVM for android course!

Hi @macsimus when will be released the new MVVM for Android course?

@amadeu01 Here is the course link - we have just released it yesterday:

I hope it helps!