Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Compose で手に入れた UI の Unit test
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
mkeeda
March 10, 2023
Programming
2.2k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Compose で手に入れた UI の Unit test
Android Test Night #8 で話したスライド
https://testnight.connpass.com/event/274733/
mkeeda
March 10, 2023
More Decks by mkeeda
See All by mkeeda
Google I/O 2026 個人的に気になりトピック
mkeeda
0
30
アジャイル & スクラム入門
mkeeda
0
200
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
5.6k
Android StudioのAIコーディングツール、 ぶっちゃけどうなん???
mkeeda
0
640
DataStoreをテストする
mkeeda
0
600
時計仕掛けのCompose
mkeeda
1
570
What's new in Firebase for building gen AI features気になったところ
mkeeda
0
990
手動DIの教訓
mkeeda
0
310
WebViewと向き合う
mkeeda
2
1.7k
Other Decks in Programming
See All in Programming
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
140
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
420
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
880
VibeCodingからAgenticWorkflowへ
starfish719
0
370
数百円から始めるRuby電子工作
tarosay
0
140
Foundation Models frameworkで画像分析
ryodeveloper
1
610
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
380
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
360
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
500
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
680
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.2k
The agentic SEO stack - context over prompts
schlessera
0
860
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
エンジニアに許された特別な時間の終わり
watany
108
250k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.7k
First, design no harm
axbom
PRO
2
1.2k
Bash Introduction
62gerente
615
220k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Color Theory Basics | Prateek | Gurzu
gurzu
0
410
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Claude Code のすすめ
schroneko
67
230k
Transcript
Compose UI Unit test 2 02 3 / 03 /
10 Android Test Night # 8 mkeeda
About me • mkeeda (Ҫా Ұฏ) • Twitter: @mr_mkeeda •
Github: @mkeeda • Android Engineer at Cybozu, Inc 2
Android UI 3
Domain Layer UI Layer Data Layer 4 UI elements State
holders UseCases Repositories DataSources ViewModelTest UseCaseTest RepositoryTest DatabaseTest, NetworkTest
End-to-end test 5 Domain Layer UI Layer Data Layer UI
elements State holders UseCases Repositories DataSources Espresso performAction() & assert() 😍 🤮 🤮
6 Domain Layer UI Layer Data Layer UI elements State
holders UseCases Repositories DataSources Unit test : UI ViewModel or Fake 🤮 😍 😍
UI Unit test UI disable 7 Domain Layer UI
Layer Data Layer UI elements State holders UseCases Repositories DataSources
Jetpack Compose UI f(UI state) = UI 8 @Preview @Composable
fun IntTextFieldPreview() { Surface { IntTextField( value = 0, onValueChange = {} ) } }
Compose UI 9 @Test fun `Ҏ֎ೖྗͰ͖ͳ͍`() = runComposeUiTest { var
userInputText: Int? by mutableStateOf(0) setContent { IntTextField( value = userInputText, onValueChange = { userInputText = it } ) } val notInt = "sample" onNode(hasSetTextAction()).performTextInput(notInt) onNodeWithText(notInt).assertDoesNotExist() assertThat(userInputText).isEqualTo(0) } ComposeTestRule UI
10 https://www.youtube.com/watch?v=JyUJZvJ-OV 8
UI Unit test UI UI Screenshot test 11 https://www.droidcon.com/ 20
22 / 08 / 01 /modern-testing-on-android/
Unit test 12
Instrumented test Android CI Android Robolectric Instrumented test Local test
13
My app Android framework Instrumented test (AndroidView) 14 android.view.View MyView
Android Runtime Espresso performAction() & assert()
Android class ⾒ Local test with Robolectric (AndroidView) My app
Robolectric ShadowView MyView Local JVM Espresso performAction() & assert()
Instrumented test (Compose) 16 Compose test library performAction() & assert()
My app Android framework android.graphic.Canvas MyComposable Android Runtime Compose Runtime
Semantic assert Shadow Local test with Robolectric (Compose) 17 Compose
test library performAction() & assert() My app Robolectric ShadowCanvas MyComposable Local JVM Compose Runtime
UI UI Compose UI Compose Robolectric Compose UI 18