$30 off During Our Annual Pro Sale. View Details »

What do you want to test with UI Test v2

What do you want to test with UI Test v2

I spoke it at Hakata Test Night

Shingo Tamaki

January 24, 2020
Tweet

More Decks by Shingo Tamaki

Other Decks in Programming

Transcript

  1. ͋ͳ͕ͨUIςετͰධՁ͍ͨ͠ͷ͸
    ɹ
    ԿͰ͔͢ʁ

    View Slide

  2. ࣗݾ঺հ
    !
    ۄ৓৴ޛ
    Work as iOS Engineer & Manager for Origami
    Organize try!Swift Tokyo 2020
    co-auther of iOSςετશॻ

    View Slide

  3. ݴ༿ͷఆٛʹϒϨΛײͨ͡ࣄ͸ͳ͍Ͱ͔͢ʁ

    View Slide

  4. ͳΜͪΌΒςετ

    View Slide

  5. ͳΜͪΌΒςετ
    γεςϜςετ/౷߹ςετ/݁߹ςετ/࿈݁ςετ/֎෦݁߹ς
    ετ/಺෦݁߹ςετ/ΠϯςάϨʔγϣϯςετ/֎෦ςετ/಺
    ෦ςετ/ػೳςετ/E2Eςετ/Ϣχοτςετ/୯ମςετ/ε
    τϨεςετ/ಈతςετ/੩తςετ/ϗϫΠτϘοΫεςετ/
    ϒϥοΫϘοΫεςετ/Ϣʔβʔςετ/डೖςετ/UIςετ/
    ୳ࡧతςετ/ಉ஋Ϋϥεςετ/ڥք஋ςετ/σγδϣϯςʔ
    ϒϧςετ/૊Έ߹Θͤςετ/ঢ়ଶભҠςετ/σʔλϑϩʔς
    ετ/ΞυϗοΫςετ/ABςετ/ϦάϨογϣϯςετ/ճؼς

    View Slide

  6. ςετʹؔΘΔ༻ޠ
    ςετٕ๏/ςετܭը/ςετ߲໨/ςετΞΠςϜ/ςετγφ
    ϦΦ/ςετεΟʔτ/ςετϨϕϧ/ςετϓϩηε/ςετ؍఺/
    ςετઃܭ/ςετ෼ੳ/ςετ޻ఔ/ςετΧόϨοδ/ςετ
    ϕʔε/ελϒ/ϞοΫ/ςετμϒϧ/SUT/όά/ෆ۩߹/ܽؕ/ނ
    ো/ϑΥʔϧτ/ςεςΟϯά/νΣοΩϯά/ඇػೳςετ/ςετ
    λΠϓ/ςετۦಈ։ൃ/TDD/ςετϋʔωε/.....

    View Slide

  7. View Slide

  8. ༨ஊ: JSTQBͱ͔΍ͬͯΈΔͱָ͍͠Α
    http://jstqb.jp

    View Slide

  9. ؓ࿩ٳ୊

    View Slide

  10. ςετϐϥϛου
    • UI
    • Service
    • Unit

    View Slide

  11. UIςετͱ͸ͳΜͩΖ
    ͏ʁ
    • XCUITestΛ࢖༻ͯ͠ߦ͏ςετ͸શ
    ͯUIςετʁ
    • UIʹϑΥʔΧεͨ͠ςετΛߦ͏ς
    ετʁ

    View Slide

  12. UIςετͱ͸ͳΜͩΖ
    ͏ʁ
    • UIʹϑΥʔΧεͨ͠ςετΛߦ͏ς
    ετʁ

    View Slide

  13. UIςετͱ͸ͳΜͩΖ
    ͏ʁ
    • UIʹϑΥʔΧεͨ͠ςετΛߦ͏ς
    ετʁ
    • ධՁ͍ͨ͠ͷ͕ը໘ɾUIίϯϙʔ
    ωϯτͳͲʹͷΈͰ͋Ε͹ϓϨθ
    ϯςʔγϣϯ૚ʹର͢Δ୯ମɾ݁
    ߹ςετ

    View Slide

  14. UIςετͱ͸ͳΜͩΖ
    ͏ʁ
    • ্ͷ૚ʹߦ͘΄Ͳෳࡶ౓ɾ݁߹౓͕
    ૿Ճ

    View Slide

  15. UIʹର͢Δςετͱ͍͏ΑΓ
    UIΛ൐ͬͨςετ

    View Slide

  16. UIΛ൐͏ςετͱ͸
    • E2Eςετ
    • ϒϩʔυελοΫςετ
    • γεςϜςετ
    • ૯߹ςετ

    View Slide

  17. ͜͜·ͰUIςετͷೝࣝ߹Θͤ

    View Slide

  18. ԿΛςετ͍ͨ͠ͷ͔࠶ͼࢥ͍ग़ͯ͠ΈΔ

    View Slide

  19. ԿΛςετ͍ͨ͠ͷ͔࠶ͼࢥ͍ग़ͯ͠ΈΔ
    1. UIʹϑΥʔΧεͨ͠ςετΛ͍ͨ͠
    2. UIΛ൐͏ςετΛ͍ͨ͠

    View Slide

  20. ▶︎1. UIʹϑΥʔΧεͨ͠
    ςετΛ͍ͨ͠

    View Slide

  21. XCUITestͰͳ͚Ε͹ग़དྷͳ͍ࣄ͔ʁ
    • ViewͷαΠζ΍ͦͷ্ʹࡌͬͯΔίϯϙʔωϯτͷҐஔͳͲ
    ͸ϢχοτςετͰ΋ςετՄೳ
    • εΫϦʔϯγϣοτͳͲʹΑΔը૾ͰͷධՁ
    • iOSSnapshotTestcase
    https://github.com/uber/ios-snapshot-test-case

    View Slide

  22. ▶︎2. UIΛ൐͏ςετΛ͠
    ͍ͨ

    View Slide

  23. ༷ʑͳཁҼ͕ςετΛͮ͠Β͘͢Δ
    • ΞϓϦ಺෦ͷঢ়ଶมԽ
    • ֎෦γεςϜͱͷ࿈ܞ

    View Slide

  24. ΞϓϦ಺෦ͷঢ়ଶมԽΛ੍ޚ͢Δ
    launchArguments΍launchEnvironmentΛ࢖ͬͯىಈ࣌ʹঢ়ଶ
    ͷ੍ޚΛߦ͏
    let app = XCUIApplication()
    app.launchArguments.append("UITest")
    app.launchEnvironment["GyozaAccessToken"] = "GY0Za15PERfECTF00D"
    app.launchEnvironment["DidAgreeTos"] ɹɹɹ= "1"

    View Slide

  25. ΞϓϦ಺෦ͷঢ়ଶมԽΛ੍ޚ͢Δ
    খωλ
    XCUIApplicationͷextensionͰݻ༗ͷઃఆΛΈ΍͘͢͢Δ
    let app = XCUIApplication()
    app.uitest()
    .isLoggedIn()
    .didAgreeTos()
    .launch()

    View Slide

  26. ֎෦γεςϜͱͷ࿈ܞ
    ֎෦γεςϜͷ෦෼ΛϞοΫ·ͨ͸ελϒͯ͠ಈ࡞ͤ͞Δ
    • Embassy
    • SBTUITestTunnel
    • Wiremock

    View Slide


  27. ɹ
    ͜ΕΒͷํ๏ΛऔΔࣄͰϢʔβͷૢ࡞͔Β͸ԕ͔͟Γ·͢

    View Slide

  28. ༻๏༰ྔΛकͬͯਖ਼͘͠ޮՌతͳςετΛ໨ࢦ͠·͠ΐ͏ɻ

    View Slide

  29. UIςετ͍ͭ΍Δͷʁ
    • ݪଇͱͯ͠ϢχοτςετͳͲͷςετϐϥϛουͷԼ૚͔
    ΒੵΈ্͛ͯߦ͘ํ͕๬·͍͠ʢROI͕ߴ͍ʣ
    • ↑Λཧղ্ͨ͠ͰUIςετͰΧόʔ͢Δͷ΋ѱͰ͸ͳ͍ɻ
    ϦϑΝΫλϦϯάલͷϨΨγʔίʔυΛUIςετʹΑͬͯ
    ୲อ্ͨ͠ͰɺϦϑΝΫλϦϯάޙʹϢχοτςετΛॻ
    ͘

    View Slide

  30. ·ͱΊ
    • UIςετͳͲͷݴ༿͸ఆ͕ٛϒϨ͕ͪͳͷͰ࣠Λ࡞Ζ͏
    • ݪଇʹଊΘΕΔඞཁ͸ͳ͍ɺجຊΛԡ্͑ͨ͞ͰͷΞϨϯδ
    ͸΍ͬͯ΋͍͍ɺޮՌతͩͱࢥ͑͹ࢼͯ͠ΈΕ͹͍͍͠ɺτ
    ϥΠΞϯυΤϥʔͯ͠վળ͍͖ͯ͠·͠ΐ͏

    View Slide

  31. Ҏ্

    View Slide