Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UI Test with Compose

DavidKwon7
December 10, 2023

UI Test with Compose

UI Test with Compose

- 2023년 12월 10일 GDG Devfest 2023 SongDo

DavidKwon7

December 10, 2023
Tweet

More Decks by DavidKwon7

Other Decks in Programming

Transcript

  1. 1. UI Testۆ - UI Test о ޖ঺ੋ૑ ࢓ಝࠇפ׮. Incheon/Songdo

    2. UI Test with XML - XML ӝ߈ UI Testܳ ૓೯೤פ׮. 3. UI Test with Compose - Compose ӝ߈ UI Testܳ ૓೯೤פ׮.
  2. What is the Test? - য়ܨ ध߹ - ࢿמ ഛੋ

    - ࢎਊ੗ ਃҳࢎ೦ ഛੋ - উ੹ࢿ ಣо
  3. Advantages and Disadvantages of Testing పझ౟о হ׮ݶ ੘স ୡ߈ࠗী ࢤ࢑ࢿਸ

    ֫ੌ ࣻ ੓ णפ׮. Ӓۧ૑݅ दр੉ ૑զࣻ۾ ৘࢚஖ ޅೠ ী۞੄ ߊࢤ, ࠂ੟ೠ ௏٘ ١ਵ۽ ੋ೧ ੘স ࣗਃ दрਸ ૐоೞѱ ؾפ׮. ৘ܳ ٜয, ౠ੿ ௏٘ܳ ࣻ੿೮חؘ ৘࢚஖ ޅೠ ௏٘ ীࢲ ী۞о ߊࢤೡ ࣻ ੓णפ׮. ੉ٸ పझ౟о হ׮ ݶ ੉ܳ ഛੋೡ ࣻ হणפ׮. పझ౟о হח ೐۽ં౟੄ ҃਋ द੘਷ ਬܻೞ૑݅, ੉ղ ૓ୋ੉ হਸ ੿ب۽ ו ۰૓׮. / Unit Testing
  4. How to make good Test? - ാࣚ੄ ੿ഛೠ х૑ -

    ࣁࠗ ҳഅ ࢎ೦ী ة݀੸ - ੜ ࢸݺغח पಁ - ੉೧ೡ ࣻ ੓ח పझ౟ ௏٘ - औҊ ࡅܰѱ प೯
  5. Test Case - ળ࠺ arrange : పझ౟ܳ ૓೯ೞӝ ਤ೧ ജ҃

    ࢸ੿ (੄ઓࢿ ࢸ੿, పझ౟ ؀࢚੉ غח ௿ېझ੄ ੋझఢझܳ ৢ߄ܰѱ ࢸ੿ೞҊ ࢤࢿ ١) - प೯ act : పझ౟ ઺ੋ ز੘ਸ पઁ۽ ഐ୹ೞח ௏٘ܳ աఋմ׮. - ױ঱ assert : పझ౟ ઺ੋ ز੘੉ प೯غҊ աݶ पઁ۽ ৢ߄ܲ ੌ੉ ߊࢤ೮ח૑ ഛੋ೧ঠ ೠ׮. ৈӝীח ੌ߈੸ਵ۽ ߈ജч੉ ৘࢚ೠ чҗ эѢա ੌࠗ ҃җ ࢚కо ৘࢚җ э਷૑ ഛੋೞח ੘ স੉ ನೣ.
  6. Types of Tests Unit Test - ੘਷ ௏٘ ઑпਸ ѨૐೞҊ

    - ࡅܰѱ ࣻ೯ೞҊ - Ѻܻػ ߑधਵ۽ ୊ܻೠ׮.
  7. Types of Tests Integration Test - ױੌ ز੘ ױਤܳ ѨૐೞҊ

    - ࡅܰѱ ࣻ೯ೞҊ - ׮ܲ పझ౟৬ ߹ب۽ ୊ܻೠ׮. * ױਤపझ౟ী݅ ੄ઓೞݶ दझమ੉ ੹୓੸ਵ۽ ੜ ز੘ೞח૑ ഛन ࠛоמ.
  8. Types of Tests UI Test (GUI Test) - ചݶ ղীࢲ੄

    Action੉ ઁ؀۽ ੘زೞח૑ ഛੋ. - ݽٚ ز੘ী ؀೧ ೞաೞա ࢚ࣁ൤ ഛੋೞח Ѫ੉ য۵׮. Ӓۧӝ ٸޙী ੉۞ೠ Actionী ؀೧ ௏٘۽ ۽ ૒ਸ ૞֬਷ റী, ૑ࣘ੸ਵ۽ ҙܻೞח Ѫ੉ ੢ӝ੸ਵ۽ח ݒ਋ ಞܻೞ׮. - ୶о੸ਵ۽ ৘࢚஖ ޅೠ UI ղীࢲ੄ جߊ࢚ടীب ؀୊ оמೞ׮.
  9. 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
  10. Espresso UI Test ࣽࢲ Find ೧׼ ஹನք౟ ଺ӝ Action ౠ੿

    ӝמ ࣻ೯ Assert ౠ੿ ӝמী ؀ೠ Ѿҗ ഛੋ
  11. View Matcher : ਗೞח view ଺ӝ - withId - withText

    - withContentDescription - … What is the Espresso?
  12. What is the Jetpack Compose? Jetpack Composeח ֎੉౭࠳ Android UIܳ

    ࠽٘ೞӝ ਤೠ ୭न بҳ ః౟. - ௏٘ хࣗ - ૒ҙ੸ - ࡅܲ ѐߊ җ੿ - ъ۱ೠ ࢿמ
  13. Semantic Semantic - UI ҅க ҳઑ৬ ࢚ഐ੘ਊ೤פ׮. - दݔ౮਷ UI

    ਃࣗী ੄޷ܳ ࠗৈ - दݔ౮ ౟ܻח UI ҅க ҳઑ৬ ೣԋ ࢤࢿغҊ UI ҅க ҳઑܳ ഋࢿ ೤פ׮. Compose పझ౟ীࢲח दݔ౮ ౟ܻۄח ҳઑܳ ࢎਊೞ ৈ ചݶীࢲ ਃࣗܳ ଺ই ࣘࢿਸ ੍ਸ ࣻ ੓णפ׮.
  14. What is the Node? + ֢٘ח ޖ঺? ‘दݔ౮ ੄޷о ੓ח

    UI౟ܻ੄ ݽٚ ֢٘ীח दݔ౮ ౟ܻী ߽۳ ֢٘о ੓णפ׮. दݔ౮ ౟ܻ੄ ֢٘ীח ࢚ ਽ೞח ஹನ੷࠶੄ ੄޷ܳ ੹׳ೞח ࣘࢿ੉ ನೣغয ੓णפ׮.’
  15. 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
  16. Semantic Error ߽೤੉ ػ ҃਋ী ੿ഛೠ чਸ о૑Ҋ ੓૑ ঋח

    ҃਋ ઓ੤. ੉ ٸ modifier.semantics ߂ clearAndSetSemanticsܳ ࢎਊೞৈ ૒੽੸ਵ۽ ࣘࢿਸ ૒੽ ࢸ҅ೞѢա ੤੿ ੄ೡ ࣻ ੓਺.
  17. Compose UI Test Methods Actions - performClick - performScrollTo -

    performImeAction - … https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
  18. Compose UI Test Methods Assertion - assert - assertExist -

    assertIsSelected - assertIsEqualTo - … https://developer.android.com/jetpack/compose/testing-cheatsheet?hl=ko
  19. Compose Animation UI Test - Composeܳ ࢎਊೣਵ۽ॄ, গפݫ੉࣌ పझ౟о ૓೯ؼ

    ٸ ࣗਃغח दрী ؀೧ ৮߷ೞ ѱ ઁযо оמ೤פ׮. - ੉ܳ ా೧ গפݫ੉࣌੉ ૓೯غח زউ ઺р чী ؀ೠ ഛੋ੉ оמ೧૘פ׮.
  20. Left Aligned Title enabled = trueীࢲ গפݫ੉࣌ द੘ advanceTimeBy ܳ

    ࢎਊೞৈ ਗೞח द੼ਵ۽ ੉ز ৘࢚غח Ѿҗ৬ ࠺Ү ߂ ഛੋ