Page Object Pattern with XCUITest

88cc995ce5954b15c12ea14904258757?s=47 Kento Nagata
February 28, 2019

Page Object Pattern with XCUITest

potatotips #59での発表。XCUITestを使ったPage Object Patternを紹介。
内容は記事にもまとめていますので、こちらもどうぞ。
https://www.wantedly.com/companies/wantedly/post_articles/155005

88cc995ce5954b15c12ea14904258757?s=128

Kento Nagata

February 28, 2019
Tweet

Transcript

  1. ©2018 Wantedly, Inc. Page Object Pattern with XCUITest potatotips #59

    2019/02/28 Kento Nagata, Wantedly, Inc.
  2. ©2018 Wantedly, Inc. ,FOUP/BHBUB 8BOUFEMZ *OD4PGUXBSF&OHJOFFS 8IBU*EPOPX ɾ(SPXUIPG8BOUFEMZ7JTJU 
 &OHJOFFSJOH

    ɾ3BJMTZFBST ɾJ044XJGUZFBS/FX
  3. ©2018 Wantedly, Inc. 6*౷߹ςετΛ΋ͬͱྑ͘͢Δ
 1BHF0CKFDU1BUUFSO ࠓ೔࿩͢͜ͱ

  4. ©2018 Wantedly, Inc. 9$6*5FTUͰ6*ͷ౷߹ςετΛॻ͖͍ͨ લఏ

  5. ©2018 Wantedly, Inc. 1BHF0CKFDU1BUUFSO͸ɺ
 ςετର৅Ͱ͋ΔϖʔδΛந৅Խͯ͠ɺ
 %3:͔ͭ3FBEBCMFͳ
 ςετίʔυΛ࣮ݱ͠·͢ɻ

  6. ©2018 Wantedly, Inc.  ॏෳͨ͠ίʔυ  ҙਤͷಡΈͮΒ͍ίʔυ Page Object Pattern

    ͕ղܾ͢Δ՝୊
  7. ©2018 Wantedly, Inc. ৽نొ࿥ϑϩʔͷྫ

  8. ©2018 Wantedly, Inc. 8FMDPNF1BHF ىಈ௚ޙͷ࠷ॳͷϖʔδ ɾΠϯετʔϧޙʹॳΊͯىಈͨ͠ޙ ɾ৽نొ࿥͔ϩάΠϯΛબ୒Ͱ͖Δ ɾࠓճ͸4JOH6QϘλϯΛԡ͢ ৽نొ࿥ϑϩʔͷྫ

  9. ©2018 Wantedly, Inc. 4JHOVQ1BHF ৽نొ࿥ϖʔδ ɾ&NBJMɺύεϫʔυɺ໊લΛೖྗͰ͖Δ ɾશͯೖྗ͢Δͱ4JHOVQϘλϯ͕ԡͤΔ ৽نొ࿥ϑϩʔͷྫ

  10. ©2018 Wantedly, Inc. 4JHOVQ1BHF ৽نొ࿥ϖʔδ ɾ&NBJMɺύεϫʔυɺ໊લΛೖྗͰ͖Δ ɾશͯೖྗ͢Δͱ4JHOVQϘλϯ͕ԡͤΔ ৽نొ࿥ϑϩʔͷྫ

  11. ©2018 Wantedly, Inc. $PNQMFUF1BHF ׬ྃϖʔδ ɾొ࿥͕׬ྃͨ͜͠ͱΛ఻͑Δ ɾ4UBSUϘλϯΛԡ͢ͱ࢖͍࢝ΊΒΕΔ ৽نొ࿥ϑϩʔͷྫ

  12. ©2018 Wantedly, Inc. Welcome Page Sign up Page Complete Page

  13. ©2018 Wantedly, Inc. ςετίʔυ 9$6*5FTUͰͦͷ··ॻ͍ͯΈΔ

  14. ©2018 Wantedly, Inc.

  15. ©2018 Wantedly, Inc.

  16. ©2018 Wantedly, Inc.

  17. ©2018 Wantedly, Inc.

  18. ©2018 Wantedly, Inc.

  19. ©2018 Wantedly, Inc.

  20. ©2018 Wantedly, Inc.

  21. ©2018 Wantedly, Inc.

  22. ©2018 Wantedly, Inc.  ॏෳͨ͠ίʔυ w Ϣʔβ΍؀ڥʹͳͲͷ৚݅ʹΑͬͯ෦෼తͳ෼ذͳͲ͕͋Δ৔߹ɺ༷ʑͳέʔεͰςετ͍ͨ͠ w ͋Γ͕ͪͳΞϓϩʔν͸ɺίϐϖɺϝιου੾Γग़͠ w

    ίϐϖ͸ɺ%3:Ͱͳ͘มԽʹऑ͍ w ϝιου੾Γग़͠͸ɺந৅Խͷཻ౓͕ἧΘͣಡΈͮΒ͍  ҙਤͷಡΈͮΒ͍ίʔυ w 8IBUΛίϝϯτͨ͘͠ͳΔͷ͸ɺѱ͍αΠϯ w ຊདྷͷ੹຿͸ɺҰ࿈ͷૢ࡞ͷྲྀΕͱΞαʔγϣϯ͚ͩ Կ͕໰୊͔
  23. ©2018 Wantedly, Inc. ͦ͜Ͱɺ1BHF0CKFDU1BUUFSO

  24. ©2018 Wantedly, Inc.

  25. ©2018 Wantedly, Inc. WelcomePage class

  26. ©2018 Wantedly, Inc. WelcomePage class SignUpPage class

  27. ©2018 Wantedly, Inc. WelcomePage class SignUpPage class CompletePage class

  28. ©2018 Wantedly, Inc. WelcomePage class SignUpPage class CompletePage class func

    tapSignUpButton() func tapLoginButton() var errorMessage: String func typeEmail(_:) func typePassword(_:) func typeName(_:) func tapSignUpButton() var userName: String func tapStartButton()
  29. ©2018 Wantedly, Inc. WelcomePage class SignUpPage class CompletePage class func

    tapSignUpButton() func tapLoginButton() var errorMessage: String func typeEmail(_:) func typePassword(_:) func typeName(_:) func tapSignUpButton() var userName: String func tapStartButton() ݱࡏͷঢ়ଶΛฦ͢ϓϩύςΟ
  30. ©2018 Wantedly, Inc. WelcomePage class SignUpPage class CompletePage class func

    tapSignUpButton() func tapLoginButton() var errorMessage: String func typeEmail(_:) func typePassword(_:) func typeName(_:) func tapSignUpButton() var userName: String func tapStartButton() ͦͷϖʔδ΁ͷૢ࡞ͷϝιου
  31. ©2018 Wantedly, Inc.  ॳظԽ࣌ʹͦͷϖʔδͷଘࡏΛΞαʔγϣϯ  ૢ࡞ͷϝιου͸࣮ߦޙͷ1BHFΦϒδΣΫτΛ
 ฦ͢ • ϝιουνΣʔϯ͕Ͱ͖Δ

    • ը໘ભҠ͕ൃੜ͠ͳ͍৔߹͸selfΛฦ͢ Page Object Pattern ͷϙΠϯτ
  32. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  33. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  34. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  35. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  36. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  37. ©2018 Wantedly, Inc. Page Object Patter Λ࢖ͬͨςετίʔυ

  38. ©2018 Wantedly, Inc. ಡΈ΍͘͢ͳͬͨʂ

  39. ©2018 Wantedly, Inc. ۩ମతͳ࣮૷ 1BHF1SPUPDPMͱͦͷ۩ମ࣮૷ͷ঺հ

  40. ©2018 Wantedly, Inc. 1BHF1SPUPDPM ϓϩτίϧΛ࡞Ζ͏ ࠷௿ݶͷΠϯλʔϑΣΠεΛἧ͑ΔͨΊʹ1SPUPDPM Λ࡞Γ·͢ɻ ɾBQQଞͷ1BHFΛ࡞ΔͨΊʹอ࣋͠·͢ ɾWJFXϖʔδΛද͢਌ཁૉ 7JFX$POUSPMMFSͷWJFX

    ʹͳΔ͜ͱ͕ଟ͍  ɾJOJU BQQΛड͚औͬͯηοτ͢Δ͜ͱΛظ଴͠· ͢ 1BHF1SPUPDPM ۩ମతͳ࣮૷
  41. ©2018 Wantedly, Inc.

  42. ©2018 Wantedly, Inc. Page Protocolʹ४ڌ

  43. ©2018 Wantedly, Inc. Page Protocolʹ४ڌ

  44. ©2018 Wantedly, Inc. ϖʔδ্ͷΤϥʔϝοηʔδΛද͢ϓϩύςΟ

  45. ©2018 Wantedly, Inc. ૢ࡞ʹඞཁͳཁૉΛ༻ҙ

  46. ©2018 Wantedly, Inc. ֤ૢ࡞ͷϝιουΛఆٛɺૢ࡞ޙͷϖʔδΛฦ͢

  47. ©2018 Wantedly, Inc.  ૢ࡞ʹඞཁͳཁૉ΋1SJWBUFQSPQFSUZͰఆٛ w ֤ૢ࡞ϝιουͷఆٛ΋γϯϓϧʹͳΔ  Ξαʔγϣϯʹඞཁͳϖʔδͷঢ়ଶ͸
 $PNQVUFEQSPQFUZͱͯ͠ఆٛ

    w ඞཁ࠷௿ݶͷཁૉ͚ͩΛฦ͢ w ෳࡶʹͳΔͳΒઐ༻ͷ4USVDUΛఆٛ͢Δͷ΋͋Γ Page ͷ࣮૷ͷϙΠϯτ
  48. ©2018 Wantedly, Inc. ·ͱΊ

  49. ©2018 Wantedly, Inc. w 1BHF0CKFDU1BUUFSO͸%3:͔ͭ3FBEBCMFͳ
 6*ςετΛ࣮ݱͰ͖Δ w ͜ͷύλʔϯ͸"OESPJE΍8FCͰ΋࢖͑Δ w ͲΜͲΜ׆༻͍ͯ͜͠͏

    ·ͱΊ