Open
Conversation
added 4 commits
April 17, 2022 21:18
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 확장함수로 선언하여 개선
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://ivy-hedgehog-78c.notion.site/AAK-5-1-Testing-Basics-d3b7af0d9d53417f89319030056b66d2