Тёмный
No video :(

Android Testing ViewModel - Common problems 

Renaro Santos
Подписаться 1,2 тыс.
Просмотров 7 тыс.
50% 1

Unit tests are very important in software development, they are much faster and more reliable than UI/Integration tests.
A lot of companies are interested in finding people that know the best practices of unit tests.
Here I will explain about the common issues you might face when testing your ViewModel.
If you have questions let me know in comments or in my social networks!
If you wanna know how to implement it in a real Android app check my course.
Link for the course:
~ 📚 bit.ly/cleanco...
If you wanna follow the course and can't afford it, send me a connection on LinkedIn and I will share the course with you for FREE!
LinkedIn: / renaro
Link for the code in github:
~ github.com/ren...

Опубликовано:

 

20 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@francotavares5448
@francotavares5448 11 месяцев назад
Conteúdo de primeira linha!! Tem pouquíssimo conteúdo por aí sobre testes no Android e vc me ajudou muito nesse vídeo, valeuu
@mouzinu
@mouzinu 11 месяцев назад
Que vídeo bom mano!!! Por favor, faz uma série de test em android, tem pouquissimo conteúdo sobre.
@philipjanbaruis7040
@philipjanbaruis7040 Год назад
Another treasure I just found.
@andyli619
@andyli619 Год назад
great video great explaination of unit test. I learned a lot from this awesomevideo thank you bro!
@Renaro
@Renaro Год назад
Happy to read this!
@brahianmartinez2270
@brahianmartinez2270 Год назад
bro, really thank you! finally made my viewmodel tests work, all I was missing was this dispatcher.scheduler.advanceUntilIdel() function before doing the assertions, thank you! new subscriber here!
@Renaro
@Renaro Год назад
Happy to help! Subscribing would help the channel if you can :)
@brahianmartinez2270
@brahianmartinez2270 Год назад
@@Renaro yeah, already subscribed! :)
@thencode8403
@thencode8403 Год назад
You're awesome ❤
@user-ni4iq2qk6n
@user-ni4iq2qk6n 11 месяцев назад
great video. I have learned more, You have another about Unit tests and UI tests can share me
@Klash1100
@Klash1100 Год назад
Dude, thank you!
@siddharthshah4220
@siddharthshah4220 7 месяцев назад
Amazing video! Thank you for explaining this. One doubt: So, if we move away from coroutines, livedata to something else, our Unit Tests needs to be changed as well. Aren't Unit tests suppose to be independent of the implementation details?
@thecreative9102
@thecreative9102 Год назад
A lot of boiler plate code to use observer in the test class, instead create a separate LiveDataUtil file
@Renaro
@Renaro Год назад
Indeed that could help!
@firaszuriekat8341
@firaszuriekat8341 Год назад
Great but could we use this dispatcher for Instrumented tests? I love to see AndroidTests (instrumented) tests. Very few example on that.
@Renaro
@Renaro Год назад
Hey Firas, for Instrumented tests you don't need it, you can mock the responses of your ViewModel. I will create a video about that!
@firaszuriekat8341
@firaszuriekat8341 Год назад
@@Renaro So grateful. I know Mockk or Mockitp are there to help.
@InimigoDaEscala6x1
@InimigoDaEscala6x1 Год назад
nice video, thanks
@thencode8403
@thencode8403 Год назад
I am having trouble testing cold flows. Stateflow create with stateIn function. I need to collect it first before I can check it new not initial value
@dragonzhao433
@dragonzhao433 Год назад
this only check for state change but how we verify the livedata changed with observer?
@andrevini8099
@andrevini8099 Год назад
Hi, I am having a problem that my viewModel uses the function init{} and it is pointing that I Method getMainLooper in android.os.Looper not mocked. for this, any tips?
@Renaro
@Renaro Год назад
I would recommend injecting a dispatcher as an argument to the viewModel, then you can easily replace it for a Test dispatcher for unit tests, see it here: developer.android.com/kotlin/coroutines/coroutines-best-practices
@andrevini8099
@andrevini8099 Год назад
@@Renaro Thank you very much Renaro, what I did was instantiate my view model inside my setup function after Dispatchers.setMain(dispatcher)
Далее
Clean Architecture in Android in 5 minutes
5:17
Просмотров 19 тыс.
МАМА И ВАЛДБЕРИС
00:48
Просмотров 590 тыс.
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
Write your first Compose UI test
7:01
Просмотров 42 тыс.
The Top 3 State Management Mistakes On Android
14:30
Просмотров 23 тыс.
Biggest mistake when building BIG apps.
4:12
Android MVP - Part 2 (Presenter)
5:33
Просмотров 7 тыс.
Salary Negotiation tips: what NOT to do
4:00
Cypress Testing with React - Simple Tutorial
12:43
Просмотров 43 тыс.