Kotaro666-dev / android-project-refactoring

Apache License 2.0
1 stars 0 forks source link

テストを追加 #7

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

現在のプログラムではテストがありません。UnitTest や UITest を追加してください。

Kotaro666-dev commented 1 year ago

参考資料

JUnit4 を使用する場合

以前に書いた以下の記事を参考にして対応していく

https://zenn.dev/kotaro666/articles/android-unit-test-sample

プロジェクト内で使用しているテスト関係のライブラリ群

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
Kotaro666-dev commented 1 year ago

課題

Dagger Hilt ライブラリで依存性注入したアーキテクチャの場合、Fragment の UI テストに withId でのレイアウトやウィジェットの探索が終わらない状態となっていた。 そのため、代替案として findViewById でテストしたいレイアウトやウィジェットの探索を行い、テストケースを作成しました。

Kotaro666-dev commented 1 year ago

対応内容が develop にマージされましたので、本 Issue をクローズします。