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

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

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

Yusuke Hosonuma

June 19, 2017
Tweet

More Decks by Yusuke Hosonuma

Other Decks in Programming

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. ର৅ը໘ʢϩάΠϯը໘ʣ 5 Copyright (C) DeNA Co.,Ltd. All Rights Reserved. ʙςετͷྲྀΕʙ

    1. ϝʔϧΞυϨεΛೖྗ 2. ύεϫʔυΛೖྗ 3. ϩάΠϯϘλϯΛλοϓ 4. ϩάΠϯ͕੒ޭͯ͠ɺ
 ׬ྃը໘΁ભҠ͢Δ
  4. ˚ ೖྗॲཧ͸ tap() ͱ typeText() ͷ྆ํ͕ඞཁ 8 Copyright (C) DeNA

    Co.,Ltd. All Rights Reserved. ຖճηοτͰݺͼग़͢ඞཁ͕͋ͬͯ৑௕ɾɾɾ
  5. ⭕ ೖྗॲཧΛextensionͰϝιουԽ͢Δ 10 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    XCUIElementΛ֦ு ςετͱͯ͠΍Γ͍ͨຊ࣭͕Έ͑΍͘͢ͳͬͨʂ
  6. ˚ inputText() ͷதͰམ͍ͪͯͨɾɾɾ 14 Copyright (C) DeNA Co.,Ltd. All Rights

    Reserved. ΤϥʔͷҐஔ͕ςετϝιουຊମ͔Β ཭Ε͍ͯͯඇৗʹ෼͔ΓͮΒ͍ ෳ਺͜͜Ͱམ͍ͪͯͨ৔߹ɺ Τϥʔ͕͜͜ʹू໿͞Εͯ͠·͏
  7. ˚ ৄ͘͠ग़͍ͯΔɾɾɾ͚Ͳ 16 Copyright (C) DeNA Co.,Ltd. All Rights Reserved.

    ࣦഊͨ͠Օॴʹ௚઀δϟϯϓग़དྷͳ͍͠ɺ ԿΑΓख͕ܰ͞଍Γͳ͍ɾɾɾ
  8. ˒ XCTAssert Ͱ file ͱ line ͕ࢦఆͰ͖Δ 24 Copyright (C)

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

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

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

    Τϥʔ͕ൃੜͨ͠Ґஔ͕෼͔Γ΍͘͢ͳͬͨʂ ϝοηʔδ΋਌੾ʂ