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

組織にテストを書く文化を根付かせる戦略と戦術 / Strategy and Tactics of Building Automated Testing Culture into Organization

組織にテストを書く文化を根付かせる戦略と戦術 / Strategy and Tactics of Building Automated Testing Culture into Organization

2017/12/19 Tech Night @ Shiodome # 6
https://techsio.connpass.com/event/72585/

Takuto Wada

December 19, 2017
Tweet

More Decks by Takuto Wada

Other Decks in Programming

Transcript

  1. ૊৫ʹςετΛॻ͘
    จԽΛࠜ෇͔ͤΔ
    ઓུͱઓज़
    ࿨ా୎ਓ !U@XBEB

    %FD !ςΫγΦ

    View full-size slide

  2. ࿨ా୎ਓ
    UXBEB
    U@XBEB
    UXBEB

    View full-size slide

  3. ؂मɺ؂༁ɺ຋༁ͨ͠ຊͨͪ

    View full-size slide

  4. テスト書いてますか!!
    ελϯυ໊ϫΠϧυɾαόϯφ

    View full-size slide

  5. “流しのペアプロ業”

    View full-size slide

  6. 8%#13&447PMɺ݄೔ൃചɺ૑ץप೥ه೦߸

    View full-size slide

  7. assert(typeof item.id === 'strong')
    | | | |
    | | | false
    | | "foo"
    | Item{id:"foo",name:"bar"}
    "string"
    --- [string] 'strong'
    +++ [string] typeof item.id
    @@ -1,6 +1,6 @@
    str
    -o
    +i
    ng
    power-assert
    IUUQTHJUIVCDPNQPXFSBTTFSUKTQPXFSBTTFSU

    View full-size slide

  8. ΑΖ͓͘͠ئ͍͠·͢

    View full-size slide

  9. ઓུฤ
    ૊৫ʹςετΛॻ͘
    จԽΛࠜ෇͔ͤΔ

    View full-size slide

  10. ݱ৔͔ΒͷதܧͰ͢

    View full-size slide

  11. ർฐ͖ͬͨ͠ݱ৔

    View full-size slide

  12. IUUQTXXXqJDLSDPNQIPUPTPLJOBXBTPCB
    ߥΈ͖ͬͨίʔυ

    View full-size slide

  13. ര஄ॲཧͷΑ͏ͳϦϦʔε

    View full-size slide

  14. lςετ͕ͳ͍ίʔυ͸
    ϨΨγʔίʔυͩʂz

    View full-size slide

  15. ͭͷlͳΒΘ͠z

    View full-size slide

  16. IUUQTXXXqJDLSDPNQIPUPTELBMP
    lςετΛॻ࣌ؒ͘͸ͳ͍z

    View full-size slide

  17. ετϨε
    ςετ

    View full-size slide

  18. ࣗಈςετ
    ετϨε

    View full-size slide

  19. ςετΛॻ͕࣌ؒ͘ͳ͍ͷͰ
    ͸ͳ͘ɺςετΛॻ͔ͳ͍͔
    Β͕࣌ؒͳ͘ͳΔͷͰ͢ɻ

    View full-size slide

  20. lಈ͘ίʔυʹ৮ΕΔͳz
    IUUQTXXXqJDLSDPNQIPUPT!/

    View full-size slide

  21. &EJU1SBZ͸ࢮ͕଴͍ͬͯΔ

    View full-size slide

  22. w จԽͷৢ੒͸೥୯ҐͷࣄۀʹͳΔ
    w ʮςετΛॻ͕࣌ؒ͘ͳ͍ʯͷͰ͸
    ͳ͘ʮςετΛॻ͔ͳ͍͔Β͕࣌ؒ
    ͳ͘ͳΔʯ
    w ʮಈ͘ίʔυʹ৮ΕΔͳʯͱઓ͏ɻ
    ৮Εͳ͚Ε͹ڝ૪ྗ͕ऑ·Γɺࣄۀ
    ͸؇΍͔ʹࢮΜͰ͍͘
    จԽΛม͍͑ͯ͘

    View full-size slide

  23. ಈ͘ίʔυʹ৮Εͳ͚Ε͹ࢮ͋ΔͷΈ

    View full-size slide

  24. จԽΛม͑Δ޷ྫ70:"(&ͷʮٕज़ྗධՁձʯ
    IUUQTTFMFDLDD

    View full-size slide

  25. w ϨΨγʔίʔυվળʹਖ਼ղ͸ͳ͍
    w ςετࣗಈԽ͸ۜͷ஄ؙͰ͸ͳ͍
    w ಋೖํ๏ʹ΋ۜͷ஄ؙ͸ͳ͍
    w ಋೖΛ໨తʹͯ͠͸ͳΒͳ͍
    w ঢ়گ͸ݱ৔ʹΑͬͯશͯҟͳΔ
    ۜͷ஄ؙ͸ແ͍

    View full-size slide

  26. w 5P#FͰ͸ͳ͘"T*Tͱ/PU5P#F͔Β͸͡ΊΔ
    w ྡͷࣳ͸੨͍ɻؾʹ͠ͳ͍͜ͱ
    w ਓ͸ࣗ෼ͷ଎౓Ͱ͔͠੒௕Ͱ͖ͳ͍
    w ϓϩδΣΫτ΋ϓϩδΣΫτͷ଎౓Ͱ͔͠੒௕
    Ͱ͖ͳ͍
    w ʮ·ΘΓ͸΋͏ΈΜͳ΍͍ͬͯ·͢Αʯ͸ܶༀ
    ͳͷͰ༻๏༻ྔΛकͬͯ࢖͏͜ͱ
    ΠϚίί͔Β࢝ΊΔ

    View full-size slide

  27. w շෆշͰಈ͘ਓɺଛಘͰಈ͘ਓ
    w ϦϑΝΫλϦϯάͷշײ
    w ճؼςετͷ͓ಘײ
    w ϝτϦΫεͷୡ੒ײ
    w ͦͯ͠ϏδωεՁ஋
    ਓΛ஌Δ

    View full-size slide

  28. ཧ࿦෢૷͢Δ

    View full-size slide

  29. ෆ۩߹ͷൃݟ͕
    ஗ΕΕ͹஗ΕΔ΄Ͳ
    ίετ͕͔͔Δ
    IUUQTXXXBTURCPSHQSFTTSPPN*452#@$FSUJpDBUJPO@/FXT@@IUNM

    View full-size slide

  30. © Towersquest, Inc. 2010. all rights reserved.
    5%%ಋೖޮՌ .4 *#.

    !31
    IBM Driver MS
    Windows
    MS MSN MS Visual
    Studio
    ιʔείʔυαΠζ (KLOC)
    41 6 26 155.2
    ςετίʔυαΠζ (KLOC)
    28.5 4 23.2 60.3
    TDDΛ࠾༻͍ͯ͠ͳ͍ྨࣅϓϩ
    δΣΫτͰͷܽؕີ౓Λ̍ͱ͠
    ͨͱ͖ͷܽؕີ౓
    0.61 0.38 0.24 0.09
    TDD࠾༻ʹΑΓ૿Ճͨ͠ίʔυ
    ࣮૷࣌ؒ(؅ཧऀͷݟੵʹΑΔ) 15ʙ20% 25ʙ35% 15% 20ʙ25%
    N. Nagappan, M. E. Maximilien, T. Bhat and L. Williams: Realizing quality improvement through test driven development: results and
    experiences of four industrial teams, Journal of Empirical Software Engineering, vol. 13, pp. 289-302 (2008)

    View full-size slide

  31. © Towersquest, Inc. 2010. all rights reserved.
    5%%ಋೖޮՌ ΤϦΫιϯଞ

    w 5%%Λ࣮ࢪͨ͠৔߹ʹใࠂ͞Ε͍ͯΔ஌ݟ
    ‣ ػೳςετͰͷෆ۩߹ݕग़਺͕࡟ݮ͞Εͨ
    ‣ ίʔσΟϯά ࣮૷
    ͷ͕࣌ؒˋ૿͑ͨ
    ‣ ςετͷΧόϨοδ͕େ͖͘ͳͬͨ
    w ඃݧऀΛର৅ͱͨ͠Ξϯέʔτ
    ‣ ͷඃݧऀ͕σόοάͷ޻਺ΛݮΒ͢ͱײͨ͡
    ‣ ͷඃݧऀ͕ཁٻ͕ચ࿅͞ΕΔͱײͨ͡
    ‣ ͷඃݧऀ͕ίʔυͷ඼࣭Λ্͛Δͱײͨ͡
    ‣ ͷඃݧऀ͕։ൃ޻਺ΛݮΒ͢ͱײͨ͡
    !32
    Boby George, a and Laurie Williams: A structured experiment of test-driven development, Journal of Information and Software Technology Vol. 46, No. 5, p. 337-342(2004)

    View full-size slide

  32. w ਓ͸ͦΕͧΕͷ౓߹͍ͰมԽʹର͠
    ͯ਎ߏ͑Δ
    w લྫ͕ͳ͍ɺࣄྫ͕ͳ͍
    ม͑Δ͜ͱͷ೉͠͞

    View full-size slide

  33. ࣄલʹڐՄΛಘΔΑΓɺ͋ͱ
    Ͱڐͯ͠΋Β͏ํָ͕
    Grace Hopper
    l*UJTFBTJFSUPBTL
    GPSHJWFOFTTUIBOJUJT
    UPHFUQFSNJTTJPOz

    View full-size slide

  34. IUUQTXXXqJDLSDPNQIPUPTUPNQBHFOFU
    ςετ͸඼࣭Λ্͛ͳ͍

    View full-size slide

  35. w ඼࣭͕ʮΘ͔ΔʯΑ͏ʹͳΔ
    w Θ͔Δ͜ͱͦ͜େࣄ
    w ςετΛॻ͚ͩ͘Ͱ͸ɺྑ͘͸ͳΒͳ͍
    w ମॏܭʹ৐Δ͚ͩͰ͸૫ͤͳ͍
    w ඼࣭Λ্͛Δͷ͸ઃܭͱϓϩάϥϛϯά
    w ࠶ઃܭͱϦϑΝΫλϦϯάΛςετͰࢧ͑Δ
    ςετ͸඼࣭Λ্͛ͳ͍

    View full-size slide

  36. lςετͰ͸඼࣭͸্͕Βͳ͍
    Ͱ͢Αɻςετ͸͋͘·Ͱ΋඼
    ࣭Λ͋͛Δ͖͔͚ͬɻ඼࣭Λ͋
    ͛Δͷ͸ϓϩάϥϛϯάͰ͢ɻ
    ͜Ε͸େੲ͔Βͦ͏ɻz

    View full-size slide

  37. ૊৫ʹςετΛॻ͘
    จԽΛࠜ෇͔ͤΔ
    ઓज़ฤ

    View full-size slide

  38. ͭͷlಓ͠Δ΂z

    View full-size slide

  39. w ʮϨΨγʔίʔυͷδϨϯϚʯ
    w lίʔυΛมߋ͢ΔͨΊʹ͸ςετΛ੔උ͢Δ
    ඞཁ͕͋Δɻଟ͘ͷ৔߹ɺςετΛ੔උ͢Δ
    ͨΊʹ͸ɺίʔυΛมߋ͢Δඞཁ͕͋Δz
    w ϨΨγʔίʔυʹ৮ΔͨΊͷ

    ޠኮͱٕ๏Λ੔ཧͨ͠ຊ
    w TUBDLPWFSqPXDPN͔Βͷ

    ඃݴٴ਺ୈҐ
    ϨΨγʔίʔυվળΨΠυ

    View full-size slide

  40. w ϨΨγʔίʔυվળΨΠυΑΓ΍΍ந৅౓͕ߴ͍
    w ιϑτ΢ΣΞͷϦΤϯδχΞϦϯάΛߦ͏ͭͷબ
    ୒ࢶΛ͍ࣔͯ͠Δ
    w ϦϑΝΫλϦϯά
    w ϦΞʔΩςΫςΟϯά
    w ϏοάɾϦϥΠτ
    ϨΨγʔιϑτ΢ΣΞվળΨΠυ

    View full-size slide

  41. Ͳ͜ʹςετΛ
    ॻ͍͍͔ͯ͘

    View full-size slide

  42. w ʮԿ͕Ұ൪΍͹͍Ͱ͔͢ʁʯ
    w ࠷΋ࠔ͍ͬͯΔͱ͜Ζ͔Β
    w ͓ۚɺݸਓ৘ใɺʜʜ
    w ৽ػೳ։ൃ͔Β
    w όάमਖ਼ͷͱ͜Ζ͔Β
    w ੩తղੳͰϐϯϙΠϯτʹ
    Ͳ͔͜Β΍Δ͔

    View full-size slide

  43. ʮ௧ΜͩՕॴʯͱʮख͕ಧ͘Ռ࣮ʯ

    View full-size slide

  44. w ϦεΫ
    w खಈςετͷίετ
    w ࣗಈԽίετ
    ςετͷτϦΞʔδ

    View full-size slide

  45. ςετέʔεΛҰཡʹ·ͱΊΔ
    ςετέʔε
    σβΠϯมߋ
    ηΩϡϦςΟΞϥʔτ
    औҾཤྺ
    ޱ࠲ͷౚ݁
    ৽نϢʔβొ࿥
    ݕࡧ݁Ռͷฒͼସ͑
    ͓ۚͷೖۚ
    ৼΓࠐΈͷ֬ೝ

    View full-size slide

  46. ϦεΫΛݟੵ΋Δ
    ςετέʔε ϦεΫ
    σβΠϯมߋ
    ηΩϡϦςΟΞϥʔτ
    औҾཤྺ
    ޱ࠲ͷౚ݁
    ৽نϢʔβొ࿥
    ݕࡧ݁Ռͷฒͼସ͑
    ͓ۚͷೖۚ
    ৼΓࠐΈͷ֬ೝ

    View full-size slide

  47. खಈςετͷίετΛݟੵ΋Δ
    ςετέʔε ϦεΫ
    खಈςετͷ
    ίετ
    σβΠϯมߋ
    ηΩϡϦςΟΞϥʔτ
    औҾཤྺ
    ޱ࠲ͷౚ݁
    ৽نϢʔβొ࿥
    ݕࡧ݁Ռͷฒͼସ͑
    ͓ۚͷೖۚ
    ৼΓࠐΈͷ֬ೝ

    View full-size slide

  48. ࣗಈԽίετΛݟੵ΋Δ
    ςετέʔε ϦεΫ
    खಈςετͷ
    ίετ
    ࣗಈԽίετ
    σβΠϯมߋ
    ηΩϡϦςΟΞϥʔτ
    औҾཤྺ
    ޱ࠲ͷౚ݁
    ৽نϢʔβొ࿥
    ݕࡧ݁Ռͷฒͼସ͑
    ͓ۚͷೖۚ
    ৼΓࠐΈͷ֬ೝ

    View full-size slide

  49. ༏ઌॱҐΛ෇͚ͯฒ΂ସ͑Δ
    ςετέʔε ϦεΫ
    खಈςετͷ
    ίετ
    ࣗಈԽίετ
    ޱ࠲ͷౚ݁
    ৼΓࠐΈͷ֬ೝ
    औҾཤྺ
    ݕࡧ݁Ռͷฒͼସ͑
    ͓ۚͷೖۚ
    ηΩϡϦςΟΞϥʔτ
    ৽نϢʔβొ࿥
    σβΠϯมߋ

    View full-size slide

  50. Ͳ͏ςετΛ
    ॻ͍͍͔ͯ͘

    View full-size slide

  51. w ઀߹෦ͷݕ౼ͱۛຯ
    w ߜΓࠐΈ఺ͷൃݟͱґଘͷ෼཭
    w ࠶ݱੑ͋Δςετϋʔωεͷ੔උ
    w ௒ूதฤू )ZQFSBXBSF&EJUJOH

    w ίϯύΠϥ*%&·͔ͤ
    w ࢓༷Խςετ
    w ࢼߦϦϑΝΫλϦϯά
    ϨΨγʔίʔυվળͷٕ๏

    View full-size slide

  52. w ࠷ॳ͔Βશ෦΍Ζ͏ͱ͠ͳ͍
    w ςετۦಈʹͩ͜ΘΔͳ
    w ςετϑΝʔετʹͩ͜ΘΔͳ
    w ʮϢχοτʯςετʹͩ͜ΘΔͳ
    w ςετͷ࣮ߦ଎౓ʹͩ͜ΘΔͳ
    w ςετͷ໢ཏੑʹͩ͜ΘΔͳ
    ͩ͜ΘΔͳ

    View full-size slide

  53. w ྑ͍Ϣχοτςετͷࢦඪʹ΋༏ઌ
    ౓͕͋Δ
    w ࠶ݱɺ܁Γฦ͠Մೳ 3FQFBUBCMF

    w ಠཱ͍ͯ͠Δ *OEFQFOEFOU

    w ଞ͸ͦΕ͔ΒͰ͍͍
    ͩ͜ΘΖ͏

    View full-size slide

  54. w ςετ͕ͳ͍ͷ͸طʹઃܭ͕ѱ͍ஹީ
    w ઃܭ࣮૷Λม͑Δͷ͕લఏ
    w ࣮૷ͷςετΛॻ͔ͳ͍͜ͱ
    w ςετ͕Χόʔ͢Δൣғʹ༡ͼΛ࣋ͨ
    ͤɺΧόʔൣғ಺ΛϦϑΝΫλϦϯά
    w ঢ়گʹԠͯ͡&&ςετΛ࢖͍͜ͳ͢
    ઃܭͷՄಈҬΛ֬อ͢Δ

    View full-size slide

  55. ςετࣗಈԽϐϥϛουͱΞϯνύλʔϯ
    IUUQTXBUJSNFMPOCMPHJOUSPEVDJOHUIFTPGUXBSFUFTUJOHJDFDSFBNDPOF

    View full-size slide

  56. l5FTU4J[FTzBU(PPHMF
    IUUQTUFTUJOHHPPHMFCMPHDPNUFTUTJ[FTIUNM

    View full-size slide

  57. medium
    small
    large
    ࣗ෼ͨͪͰ4.-Λఆٛ͠ɺௐ੔͢Δ

    View full-size slide

  58. Y6OJU5FTU1BUUFSOTΑΓ
    ςετͷϝϯςφϯείετ
    ཧ૝
    ݱ࣮
    ςετͷϝϯςφϯείετ͕༩͑Δμϝʔδ

    View full-size slide

  59. w Ұ౓ʹଟ͘ͷਓΛม͑Δͷ͸೉͍͠
    w ҭͯΔͷͰ͸ͳ͘ɺࣗΒҭͭΑ͏ʹ
    w ڭ͑ΒΕΔਓΛ૿΍͢
    w ϖΞϓϩͰҰਓͣͭ
    w एखͷϗʔϓ͔ɺϕςϥϯ͔Β͔
    ͩΕͱ΍Δ͔

    View full-size slide

  60. ϖΞϓϩάϥϛϯά

    View full-size slide

  61. w ׂΕ૭ཧ࿦
    w ϝτϦΫεΛऔΖ͏
    w ΧόϨοδ͕௿͍͏ͪ͸ଌఆ͸ޮՌେ
    w খ͏Δ͍͞πʔϧΛ৐Γ͜ͳ͢
    w ෼฼෼ࢠΛݟͳ͍ɻ࣌ؒΛ௥ͬͨมԽ
    ΛݟΔɻ܏͖ΛݟΔɻ
    ݟ͑ΔԽ

    View full-size slide

  62. IUUQTXXXqJDLSDPNQIPUPTTSHCMPH
    ΞϯνύλʔϯΧόϨοδΛ
    චهࢼݧͷΑ͏ʹѻ͏

    View full-size slide

  63. IUUQTXXXqJDLSDPNQIPUPT!/
    ΧόϨοδ͸ܭثͷͻͱͭ

    View full-size slide

  64. w ಈతςετͱ੩తςετ
    w શମͷϝτϦΫεΛܭଌͯ͠၆ᛌͷ
    ࢹ఺ΛಘΔ
    w ෦෼తͳϝτϦΫεΛܭଌ͠ଓ͚ͯ
    ܏޲ΛݟΔ
    w 1.% SVCPDPQ $PWFSJUZ ʜ
    ੩తղੳΛ࢖͍͜ͳ͢

    View full-size slide

  65. w ίʔυϨϏϡʔͷΠϯϑϥʹ౤ࢿ
    w HJUIVC HJUMBC HJUCVDLFU
    w 8*1QVMMSFRVFTU
    w ίʔυΛݟΔจԽɺݟΒΕΔจԽΛ
    ҭͯΔ
    ίʔυϨϏϡʔ

    View full-size slide

  66. w αϯϓϧͱσϞ͕େࣄ
    w ਅࣅͯ͠΋Β͏౔୆Λ࡞Δ
    w ࠷ॳ͸αϯϓϧͷίϐϖͰ΋ྑ͍
    w ςετͷ͋Δੜ׆Λମݧͯ͠΋Β͏
    ͜ͱ͕େࣄ
    w ࣍ʹςετͷϝϯςφϯεΛֶͿ
    എதΛݟͤΔ

    View full-size slide

  67. w Ͱ͖Δ͔Β΍ΔͷͰ͸ͳ͍
    w ΍Δ͔ΒͰ͖ΔΑ͏ʹͳΔ
    w ͋ͳ͕ͨॻ͚ΔΑ͏ʹͳΒͳ͚Ε͹ɺ
    ୭΋ॻ͚ΔΑ͏ʹ͸ͳΒͳ͍
    4PDJBM$IBOHFTUBSUTXJUI:06

    View full-size slide

  68. ςετ͸ϓϩͷᅂΈ
    ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide