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
UI Test with Compose
Search
DavidKwon7
December 10, 2023
Programming
0
110
UI Test with Compose
UI Test with Compose
- 2023년 12월 10일 GDG Devfest 2023 SongDo
DavidKwon7
December 10, 2023
Tweet
Share
More Decks by DavidKwon7
See All by DavidKwon7
Refactoring to Expressive Kotlin
davidkwon7
0
440
Relay_및_Compose를_사용하여_완전한_앱_빌드하기.pdf
davidkwon7
0
320
Flow 느껴보기
davidkwon7
1
94
WearOS 101
davidkwon7
0
19
Other Decks in Programming
See All in Programming
【Gemini本発売記念】npaka による マルチモーダルとローカルLLMの現在と未来
npaka
3
1.2k
ゼロから始める型安全なGraphQL開発
shachi_daikon55
0
180
Google Cloud で プロダクト開発 事業として成長させるZennの例 / grows-zenn-with-google-cloud
wadayusuke
2
280
SPLから始める「データ構造」入門
o0h
PRO
6
870
フレームワークを10年以上開発する中で培ってきた単体テストのプラクティス / JJUG CCC 2024 Spring
kiwasaki
1
120
5分でわかるExplicitly Built Modules
giginet
PRO
0
180
Kotlin Collection関数をマスター
masayukisuda
0
3.4k
自分好みの TS バンドラを Rust で作れる!Deno の内部ライブラリの活用 – Denoで変わるランタイムの景色 実践事例 Lunch LT
pizzacat83
4
550
Secure Development with PHP
dbrumann
2
190
タクシーアプリ『GO』の reCAPTCHA Enterprise 導入
mot_techtalk
1
110
dbt v1.8で追加された単体テストを触ってみた
k_data_analyst
2
270
技術サポートでよく見かけるパターンと便利な活用方法
tamai_63
0
490
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
Visualization
eitanlees
137
14k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.2k
What the flash - Photography Introduction
edds
64
11k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
88
46k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
10
3.7k
Happy Clients
brianwarren
93
6.5k
Infographics Made Easy
chrislema
238
18k
Music & Morning Musume
bryan
42
5.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
40
2.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
13
1.2k
Transcript
UI Test with Compose Incheon/Songdo
What is the Purpose of this Session? UI Test ਗܻܳ
ঌҊ पઁ ۽ં ਊ
1. UI Testۆ - UI Test о ޖੋ ಝࠇפ. Incheon/Songdo
2. UI Test with XML - XML ӝ߈ UI Testܳ ೯פ. 3. UI Test with Compose - Compose ӝ߈ UI Testܳ ೯פ.
1. UI Test Incheon/Songdo
What is the Test? - য়ܨ ध߹ - ࢿמ ഛੋ
- ࢎਊ ਃҳࢎ೦ ഛੋ - উࢿ ಣо
Advantages and Disadvantages of Testing పझо হݶ স ୡ߈ࠗী ࢤࢿਸ
֫ੌ ࣻ णפ. Ӓۧ݅ दр զࣻ۾ ࢚ ޅೠ ী۞ ߊࢤ, ࠂೠ ٘ ١ਵ۽ ੋ೧ স ࣗਃ दрਸ ૐоೞѱ ؾפ. ܳ ٜয, ౠ ٘ܳ ࣻ೮חؘ ࢚ ޅೠ ٘ ীࢲ ী۞о ߊࢤೡ ࣻ णפ. ٸ పझо হ ݶ ܳ ഛੋೡ ࣻ হणפ. పझо হח ۽ં ҃ द ਬܻೞ݅, ղ ୋ হਸ ب۽ ו ۰. / Unit Testing
How to make good Test? - ാࣚ ഛೠ х -
ࣁࠗ ҳഅ ࢎ೦ী ة݀ - ੜ ࢸݺغח पಁ - ೧ೡ ࣻ ח పझ ٘ - औҊ ࡅܰѱ प೯
Test Case - ળ࠺ arrange : పझܳ ೯ೞӝ ਤ೧ ജ҃
ࢸ (ઓࢿ ࢸ, పझ ࢚ غח ېझ ੋझఢझܳ ৢ߄ܰѱ ࢸೞҊ ࢤࢿ ١) - प೯ act : పझ ੋ زਸ पઁ۽ ഐೞח ٘ܳ աఋմ. - ױ assert : పझ ੋ ز प೯غҊ աݶ पઁ۽ ৢ߄ܲ ੌ ߊࢤ೮ח ഛੋ೧ঠ ೠ. ৈӝীח ੌ߈ਵ۽ ߈ജч ࢚ೠ чҗ эѢա ੌࠗ ҃җ ࢚కо ࢚җ э ഛੋೞח স ನೣ.
Types of Tests - Unit Test - Integration Test -
UI Test
Types of Tests Unit Test - ٘ ઑпਸ ѨૐೞҊ
- ࡅܰѱ ࣻ೯ೞҊ - Ѻܻػ ߑधਵ۽ ܻೠ.
Types of Tests Integration Test - ױੌ ز ױਤܳ ѨૐೞҊ
- ࡅܰѱ ࣻ೯ೞҊ - ܲ పझ৬ ߹ب۽ ܻೠ. * ױਤపझী݅ ઓೞݶ दझమ ਵ۽ ੜ زೞח ഛन ࠛоמ.
Types of Tests UI Test (GUI Test) - ചݶ ղীࢲ
Action ઁ۽ زೞח ഛੋ. - ݽٚ زী ೧ ೞաೞա ࢚ࣁ ഛੋೞח Ѫ য۵. Ӓۧӝ ٸޙী ۞ೠ Actionী ೧ ٘۽ ۽ ਸ ֬ റী, ࣘਵ۽ ҙܻೞח Ѫ ӝਵ۽ח ݒ ಞܻೞ. - ୶оਵ۽ ࢚ ޅೠ UI ղীࢲ جߊ࢚ടীب оמೞ.
UI Test Espresso Robolectric Appium UI Automator
2. XML Incheon/Songdo
What is the XML? XML(Extensible Markup Language): ഛഋ ݃স যݴ
Android Studioীࢲ ചݶਸ Ӓܻחؘ ࢎਊػ.
What is the Espresso? Android ӝӝ ߂ ীޯۨఠীࢲ UI Test
೯ Espresso ӝࠄ ҳࢿ ਃࣗ - Espresso : onView() / onData()ܳ ాೠ ࠭৬ ࢚ഐਊਸ ਤೠ ੑ - ViewMatchers : അ view ҅க ҳઑ ղীࢲ పझೡ ࢚ ӝ - ViewActions : ࣻ೯ೡ ز - ViewAssertions : ࣻ೯ೠ ز ഛੋ https://developer.android.com/training/testing/espresso/basics?hl=ko
Espresso UI Test ࣽࢲ Find ೧ ஹನք ӝ Action ౠ
ӝמ ࣻ೯ Assert ౠ ӝמী ೠ Ѿҗ ഛੋ
Espresso UI Test Espresso UI test method ࣗѐ
https://developer.android.com/training/testing/espresso/cheat-sheet?hl=ko What is the Espresso?
View Matcher : ਗೞח view ӝ - withId - withText
- withContentDescription - … What is the Espresso?
View Action - click() - longClick() - scrollTo() - swipeRight()
What is the Espresso?
View Assertion - withText() - doesNotExist() - … What is
the Espresso?
Left Aligned Title
2. XML Incheon/Songdo - Button ߂ EditText UITest
Left Aligned Title
Left Aligned Title
Left Aligned Title
Left Aligned Title
Left Aligned Title
Left Aligned Title
Left Aligned Title
Left Aligned Title
What is the Test?
What is the Test?
Left Aligned Title
What is the Test?
3. Compose Incheon/Songdo
What is the Jetpack Compose? Jetpack Composeח ֎౭࠳ Android UIܳ
࠽٘ೞӝ ਤೠ ୭न بҳ ః. - ٘ хࣗ - ҙ - ࡅܲ ѐߊ җ - ъ۱ೠ ࢿמ
What is the Test?
XMLҗ Compose ର? - ݺ۸ഋ UI / ࢶഋ UI -
٘ ܻ࠙ - view id
What is the Test? Jetpack Composeীࢲח যڌѱ పझ ࢚ਸ ?
3. Compose Incheon/Songdo - Semantic
Semantic Semantic - UI ҅க ҳઑ৬ ࢚ഐਊפ. - दݔ౮ UI
ਃࣗী ܳ ࠗৈ - दݔ౮ ܻח UI ҅க ҳઑ৬ ೣԋ ࢤࢿغҊ UI ҅க ҳઑܳ ഋࢿ פ. Compose పझীࢲח दݔ౮ ܻۄח ҳઑܳ ࢎਊೞ ৈ ചݶীࢲ ਃࣗܳ ই ࣘࢿਸ ੍ਸ ࣻ णפ.
Semantic Semantic
Semantic Semantic
What is the Node? + ֢٘ח ޖ? ‘दݔ౮ о ח
UIܻ ݽٚ ֢٘ীח दݔ౮ ܻী ߽۳ ֢٘о णפ. दݔ౮ ܻ ֢٘ীח ࢚ ೞח ஹನ࠶ ܳ ׳ೞח ࣘࢿ ನೣغয णפ.’
Semantic ֢٘ח ޖ?
Semantic modifier.semantics
Semantic SemanticsPropertyReceiverਸ ࢎਊ೧ࢲ Semantic propertyܳ Custom೧ࢲ ࢎਊ оמ
Semantic Now In Android https://github.com/android/nowinandroid
Semantic tree visualization Scemantic ܻ दпച. - Layout Inspector بҳ
ࢎਊ - printToLog() ݫࢲ٘ ਊ.
Semantic tree visualization - Layout Inspector Menu - Tools -
Layout Inspectorਵ۽ Ӕ
Semantic tree visualization - Layout Inspector Semantic Tree ܳ ഛੋೡ
ࣻ হח ҃ - compose UI ҙ۲ ୭न ߡ ࢎਊ - Api > 29 https://stackoverflow.com/questions/75542760/compose-inspection-unavailable- could-not-determine-the-version-of-the-androidx
Semantic tree visualization - Layout Inspector https://developer.android.com/jetpack/compose/tooling/layout-inspector?hl=ko
Semantic tree visualization - printToLog() UI పझ ٘ ੑ۱
Semantic tree visualization - printToLog()
ܻ ߽ ߽غ ঋ ܻо ؼ ਃࣗ ֢٘ܳ ੌदெঠ ೠݶ
useUnMergedTreeܳ true۽ ࢸೞݶ ؾפ.
Left Aligned Title
Left Aligned Title
Semantic Error ߽ ػ ҃ী ഛೠ чਸ оҊ ঋח
҃ ઓ. ٸ modifier.semantics ߂ clearAndSetSemanticsܳ ࢎਊೞৈ ਵ۽ ࣘࢿਸ ࢸ҅ೞѢա ೡ ࣻ .
3. Compose Incheon/Songdo - Compose Basic UI Test
Compose UI Test Methods https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Compose UI Test Methods https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Finders - onNode - onNodeWithContentDescription - onNodeWithTag - onAllNodes https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Compose UI Test Methods
Left Aligned Title
Compose UI Test Methods https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko Matchers - hasScrollTo - has(No)ClickAction
- hasTestTag - …
Compose UI Test Methods Actions - performClick - performScrollTo -
performImeAction - … https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Compose UI Test Methods Assertion - assert - assertExist -
assertIsSelected - assertIsEqualTo - … https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Left Aligned Title
Compose UI Test Methods Debug - printToLog() - … https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
Left Aligned Title
Left Aligned Title
Left Aligned Title
Compose UI Test Compose Animation UI Test
Compose UI Test
3. Compose Incheon/Songdo - Compose Animation UI Test
Compose Animation UI Test - Composeܳ ࢎਊೣਵ۽ॄ, গפݫ࣌ పझо ೯ؼ
ٸ ࣗਃغח दрী ೧ ৮߷ೞ ѱ ઁযо оמפ. - ܳ ా೧ গפݫ࣌ ೯غח زউ р чী ೠ ഛੋ оמ೧פ.
Left Aligned Title autoAdvance = false ܳ ా೧ গפݫ࣌ दрਸ
ઁযೡ ࣻ णפ.
Left Aligned Title enabled = trueীࢲ গפݫ࣌ द advanceTimeBy ܳ
ࢎਊೞৈ ਗೞח दਵ۽ ز ࢚غח Ѿҗ৬ ࠺Ү ߂ ഛੋ
Left Aligned Title ٘
3. Compose Incheon/Songdo - Compose Navigation UI Test
Left Aligned Title
Left Aligned Title
Left Aligned Title
3. Compose Incheon/Songdo - Now In Android
Left Aligned Title
Left Aligned Title
ਃড Find - Action - Assert
QnA Incheon/Songdo
хࢎפ.