Skip to content

Conversation

@whitequail
Copy link

@whitequail whitequail commented Apr 18, 2022

@whitequail whitequail self-assigned this Apr 18, 2022
Hyunwoo Choi added 5 commits April 18, 2022 22:00
AndroidX 테스트 라이브러리 & 로블렉트릭 의존성 추가
androidx.test.ext:junit-ktx
androidx.test:core-ktx
org.robolectric:robolectric
뷰모델의 LiveData에 할당된 Event가 잘 동작하는지 테스트.
(1) InstantTaskExecutorRule : JUnit 테스트 룰. 테스트에 사용되는 아키텍처 컴포넌트의 백그라운드 작업이 단일 스레드에서 동작하도록 함.

(2) observeForever() : LiveData 구독 시 동작하므로, 강제로 임의의 observer를 구독하도록 함.
테스트 종료 전 구독 해제 필수.
LiveData의 observeForever 주기 관리하는 로직을
Kotlin 확장함수로 선언하여 개선
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants