Save 37% off PRO during our Black Friday Sale! »

UIテストコードの保守性を上げるリファクタリングTIPS/ios-refactor-uitest

 UIテストコードの保守性を上げるリファクタリングTIPS/ios-refactor-uitest

70d9714ea13fc1133803d61fb16e4160?s=128

Yusuke Hosonuma

June 19, 2017
Tweet

Transcript

  1. Copyright (C) DeNA Co.,Ltd. All Rights Reserved. potatotips #41 2017/06/19(Mon)

    
 ࡉপ༞հ@DeNA UIςετίʔυͷอकੑΛ্͛Δ ϦϑΝΫλϦϯάTips 1
  2. ▪ Yusuke Hosonumaʢ@tobi462ʣ • ॴଐ ⁃ %F/"48&5άϧʔϓςετج൫νʔϜ • ܦྺ ⁃

    લུɺ೥݄ʹ%F/"48&5άϧʔϓʹ+PJO • ීஈͷۀ຿ ⁃ όʔδϣϯɾΞοϓࣗಈݕূγεςϜʢϚεςΟϑʣͷ։ൃ ⁃ ΞϓϦͷςετʹ·ͭΘΔௐ͍ࠪΖ͍Ζ • ଞ ⁃ ͱ͔޷͖Ͱ͢ ࣗݾ঺հ Copyright (C) DeNA Co.,Ltd. All Rights Reserved. 2
  3. ࠓ೔ɺ࿩͢͜ͱ 3 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  4. 6*ςετίʔυͷ ϦϑΝΫλϦϯά5JQT 4 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  5. ର৅ը໘ʢϩάΠϯը໘ʣ 5 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ʙςετͷྲྀΕʙ

    1. ϝʔϧΞυϨεΛೖྗ 2. ύεϫʔυΛೖྗ 3. ϩάΠϯϘλϯΛλοϓ 4. ϩάΠϯ͕੒ޭͯ͠ɺ
 ׬ྃը໘΁ભҠ͢Δ
  6. γϯϓϧʹॻ͍ͨίʔυશମʢ͝ࢀߟʣ 6 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  7. ೖྗॲཧͷϝιουԽ 7 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  8. ˚ ೖྗॲཧ͸ tap() ͱ typeText() ͷ྆ํ͕ඞཁ 8 Copyright (C) DeNA

    Co.,Ltd. All Rights Reserved. ຖճηοτͰݺͼग़͢ඞཁ͕͋ͬͯ৑௕ɾɾɾ
  9. ڞ௨Խ͠Α͏ʂ 9 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  10. ⭕ ೖྗॲཧΛextensionͰϝιουԽ͢Δ 10 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    XCUIElementΛ֦ு ςετͱͯ͠΍Γ͍ͨຊ࣭͕Έ͑΍͘͢ͳͬͨʂ
  11. ࣮͸͜Ε͚ͩͰ͸໰୊͕͋Δ 11 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  12. ˚ inputText() ಺ͰΤϥʔ͕ൃੜͨ͠ͱ͖ 12 Copyright (C) DeNA Co.,Ltd. All Rights

    Reserved. Ͳ͜Ͱࣦഊͨ͠ͷ͔෼͔Βͳ͍ɾɾɾorz
  13. ϝιουδϟϯϓͯ͠ ίʔυΛ௥͍ͬͯ͘ͱɾɾɾ 13 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  14. ˚ inputText() ͷதͰམ͍ͪͯͨɾɾɾ 14 Copyright (C) DeNA Co.,Ltd. All Rights

    Reserved. ΤϥʔͷҐஔ͕ςετϝιουຊମ͔Β ཭Ε͍ͯͯඇৗʹ෼͔ΓͮΒ͍ ෳ਺͜͜Ͱམ͍ͪͯͨ৔߹ɺ Τϥʔ͕͜͜ʹू໿͞Εͯ͠·͏
  15. 9DPEF্ͷϩάͰݟΔʁ 15 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  16. ˚ ৄ͘͠ग़͍ͯΔɾɾɾ͚Ͳ 16 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    ࣦഊͨ͠Օॴʹ௚઀δϟϯϓग़དྷͳ͍͠ɺ ԿΑΓख͕ܰ͞଍Γͳ͍ɾɾɾ
  17. ڞ௨ԽͰ͖͚ͨͲ ࣦഊ࣌ͷௐࠪίετ͸ Ή͠Ζ্͕ͬͯΔɾɾɾʂʁ 17 Copyright (C) DeNA Co.,Ltd. All Rights

    Reserved.
  18. ʺސ٬͕ٻΊ͍ͯͨ΋ͷ 18 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  19. ೖྗॲཧͷϝιουԽ ʢύʔτ̎ʣ 19 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  20. ސ٬ͷٻΊ͍ͯΔ΋ͷ 20 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  21. ⭕ ސ٬ͷٻΊ͍ͯͨ΋ͷ 21 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    ͜͜ͷߦʹΤϥʔ͕ग़ͯཉ͍͠ʂ
  22. ʢͨͿΜʣ ͋·Γ஌ΒΕ͍ͯͳ͍͜ͱ 22 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  23. 9$5"TTFSUܥͷϝιου͸ ࣦഊҐஔΛࢦఆͰ͖Δ 23 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  24. ˒ XCTAssert Ͱ file ͱ line ͕ࢦఆͰ͖Δ 24 Copyright (C)

    DeNA Co.,Ltd. All Rights Reserved. ίʔυิ׬ʹ͸ग़ͳ͍͚Ͳ fileͱline͕ࢦఆͰ͖Δʂ ͪͳΈʹAPIϦϑΝϨϯεʹ͸ॻ͍ͯ͋Δ ͚ΕͲ๩͍͠Θ͟Θ͟ݟͳ͍
  25. ˒ ΤϥʔͷҐஔ΋ม͑ΒΕΔ 25 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    1ߦखલͰΤϥʔ͕ى͖ͨ͜ͱʹ͢Δ͜ͱ΋ ͜ΕΛར༻͢Ε͹ ద੾ͳҐஔʹΤϥʔ৘ใΛදࣔͰ͖Δʂ
  26. ⭕ ಠࣗͷΞαʔγϣϯΛ௥Ճ͢Δ 26 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    σϑΥϧτҾ਺ͱͯ͠ #file ͱ #line Λड͚औΓɺ ཁૉ͕ͳ͔ͬͨ৔߹ʹ XCTFail Ͱࣦഊͤ͞Δ
  27. ⭕ ͖ͬ͞ͱಉ͡ςετΛ࣮ߦͯ͠ΈΔͱɾɾɾ 27 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    Τϥʔ͕ൃੜͨ͠Ґஔ͕෼͔Γ΍͘͢ͳͬͨʂ ϝοηʔδ΋਌੾ʂ
  28. ސ٬ͷٻΊ͍ͯͨ΋ͷ 28 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ͪͳΈʹUIςετҎ֎Ͱ΋࢖͑ΔςΫχοΫ

  29. ·ͱΊ 29 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

  30. ·ͱΊ ڞ௨తͳॲཧ͸ϝιουԽ͠Α͏ ಠࣗͷΞαʔγϣϯΛ͍ΕͯௐࠪίετΛԼ͛Α͏ ɾগ͠ͷ޻෉͚ͩͰςετίʔυ͸ಡΈ΍͘͢ͳΔ ɾςετࣦഊ࣌ͷௐࠪ޻਺΋ݮΒͤΔ 30 Copyright (C) DeNA Co.,Ltd.

    All Rights Reserved.
  31. &OKPZUIF5FTU 31 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.