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
140
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
Jetpack Glance
davidkwon7
0
120
Refactoring to Expressive Kotlin
davidkwon7
0
580
Relay_및_Compose를_사용하여_완전한_앱_빌드하기.pdf
davidkwon7
0
450
Flow 느껴보기
davidkwon7
1
120
WearOS 101
davidkwon7
0
48
Other Decks in Programming
See All in Programming
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
270
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
340
バグを見つけた?それAppleに直してもらおう!
uetyo
0
210
CloudflareStack でRAGに入門
asahiiwm
0
150
return文におけるstd::moveについて
onihusube
1
1.4k
MCP with Cloudflare Workers
yusukebe
2
270
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
6
1.3k
Package Traits
ikesyo
1
150
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.3k
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
130
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
200
テストケースの名前はどうつけるべきか?
orgachem
PRO
1
180
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Site-Speed That Sticks
csswizardry
2
220
4 Signs Your Business is Dying
shpigford
182
21k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Being A Developer After 40
akosma
89
590k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
The Cult of Friendly URLs
andyhume
78
6.1k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
230
The Pragmatic Product Professional
lauravandoore
32
6.4k
Code Review Best Practice
trishagee
65
17k
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
хࢎפ.