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

残して価値のあるテスト設計 / Test design by specification map

残して価値のあるテスト設計 / Test design by specification map

#gotanda.rb 第37回目 で発表したスライドです。

Yuji Imagawa

June 26, 2019
Tweet

More Decks by Yuji Imagawa

Other Decks in Programming

Transcript

  1. ࢒ͯ͠Ձ஋ͷ͋Δ
    ςετઃܭ
    2019-06-26 @ gotanda.rb # 37
    Yuji Imagawa ( @ug23_ )

    View full-size slide

  2. εϚʔτΩϟϯϓͷࠓ઒Ͱ͢
    • ࠓ઒༟࢜ @ug23_
    • ΤϯδχΞ4೥໨
    • લ৬͕QAΤϯδχΞ
    • ͍·͸Rails΋΍Δ͠Vue΋΍Δ͠Πϯϑϥ΋΍Δ
    • #tddyyχ ͷͳ͔ͷͻͱ
    • ؾʹͳ͍ͬͯΔ͜ͱ: Sorbet

    View full-size slide

  3. ࠓि͔ΒΦϑΟεҠస͠·ͨ͠

    View full-size slide

  4. We are hiring!
    ࣄۀΛ૑Γ͍ͨΤϯδχΞืूதͰ͢

    [εϚʔτΩϟϯϓ ΤϯδχΞ] [ݕࡧ]

    View full-size slide

  5. ࠓ೔ͷςʔϚ
    RSpec ͱ ςετ

    View full-size slide

  6. ࢲͷ࿩͸
    ςετઃܭͷ࿩ͷ΄͏͕
    ϝΠϯͰ͢

    View full-size slide

  7. ͓͠ͳ͕͖
    • QAΤϯδχΞ࣌୅ͷ࿩
    • Α͘΍͍ͬͯΔςετઃܭ
    • RSpecʹԠ༻͢Δ

    View full-size slide

  8. QAΤϯδχΞ࣌୅ͷ࿩

    View full-size slide

  9. ςετͷϨϏϡʔ͸೉͍͠
    • ϨϏϡʔͯ͠ʂͱ౉͞ΕΔExcel
    • ্Լʹ௕͘ηϧ݁߹͞ΕͨΧςΰϦ
    • ҧ͍͕Θ͔Βͳ͍ࣅͨςετέʔε

    View full-size slide

  10. ࢥͬͨ͜ͱ
    Excelͷςετέʔε͸
    ϨϏϡʔ͢Δͷ͕೉͍͠

    View full-size slide

  11. ࢥͬͨ͜ͱ
    ExcelʹͳΔલʹϨϏϡʔ͍ͨ͠

    View full-size slide

  12. ͨͲΓண͍ͨ౴͑
    • ϚΠϯυϚοϓ͔Β࢝ΊΔ
    ιϑτ΢ΣΞςετ
    • ஑ా ڿ (ஶ), ླ໦ ࡾل෉ (ஶ)
    • ϚΠϯυϚοϓͷ

    ࡉ͔͍࿩͸ׂѪ͠·͢

    View full-size slide

  13. ϚΠϯυϚοϓͷΑ͍ͱ͜Ζ
    • ॻ͘աఔͰ΋಄Λ੔ཧͰ͖Δ
    • ݟΔଆ΋จষΑΓ͸ݟ΍͍͢
    • πϦʔͳͷͰࣗ෼ͷݟΔ໨తʹΑͬͯ

    ୳ࡧ๏Λબ୒Ͱ͖Δ
    • ਂ͞༏ઌ or ෯༏ઌ
    • ༿·ͰݟΔ or ͋Δ֊૚͚ͩ௥͏
    ※ޮՌʹ͸ݸਓ͕ࠩ͋Γ·͢

    View full-size slide

  14. Α͘΍͍ͬͯΔςετઃܭ

    View full-size slide

  15. ϚΠϯυϚοϓΛ࢖͍·͢
    • ํ਑΍େ·͔ͳέʔεΛߟ͑Δ࣌

    ϚΠϯυϚοϓΛॻ͖·͢
    • ޙ͔ΒRSpecॻ࣌͘ͱ͔ɺखಈͷγεςϜςετʹͳΔ৔߹
    • ࣗ෼͚ͩͷͱ͖͸εέονϒοΫʹ

    ඳ͖·͕͢Gitʹ͋͛ΒΕͳ͍…

    View full-size slide

  16. GitͰ؅ཧͰ͖ΔϚΠϯυϚοϓΛ࡞Δ
    • Markdown→ϚΠϯυϚοϓԽ͢Δ
    • ࣗ෼͸ Atomͷ Markdown Mindmap 

    Λར༻͍ͯ͠·͢

    View full-size slide

  17. ςετઃܭ༻ϚΠϯυϚοϓͷॻ͖ํ
    • ֊૚਺͸ߟ͑ͳ͍
    • ͷͼͷͼॻ͘ʂ
    • ը໘ΛΠϝʔδͯ͠΋͍͍͠

    Ϋϥε౳ผͷ୯ҐΛΠϝʔδͯ͠΋ྑ͍
    • ༿ͷཁૉ͕1ͭҎ্ͷςετέʔεʹ

    ରԠ͢ΔΑ͏ʹॻ͘

    View full-size slide

  18. ࢖͍ํ
    • ςετέʔεͷϨϏϡʔ࣌ʹ࢖͏
    • ৽ϝϯόʔ͕ೖͬͨ࣌ͳͲ

    ͦͷγεςϜͷ࢓༷Ұཡͱͯ͠ݟͤΔ
    • ΈΜͳͰख෼͚ͯ͠ಈ࡞֬ೝ͍ͨ࣌͠

    ʮ͜ͷล΍ͬͯʯͱ͔ਤࣔ͢Δ
    • ػೳ͕େ͖͘มΘͬͨΒϓϧϦΫग़͢

    View full-size slide

  19. ෭࡞༻ͱͯ͠
    γεςϜͷػೳΛࣔͨ͠

    ஍ਤʹ΋ͳΔ

    View full-size slide

  20. RSpecʹԠ༻͢Δ

    View full-size slide

  21. ͦ΋ͦ΋RSpec͸
    • ΋ͱ΋ͱBDDπʔϧ
    • ࢲୡ͸SpecificationΛॻ͍͍ͯΔ
    • "rpsec --format documentation" ͱ

    ࣮ߦͯ͠Έͯ΄͍͠
    • ڵຯΛ࣋ͬͨํ͸

    ʰςετۦಈ։ൃʱ(ΦʔϜࣾ)ͷ෇࿥C΁

    View full-size slide

  22. RSpecΛ࢓༷ॻͰ͋Δ͔ͷΑ͏ʹॻ͖͍ͨ
    • ςετΛ࣮ߦͯ݁͠ՌΛಡΉͱ

    ͦͷ෦෼ͷίʔυͷ࢓༷͕Θ͔ΔΑ͏ʹ

    ͍͖͍ͯͨ͠
    • ͖ͬ͞ͷϚΠϯυϚοϓͱؔ࿈෇͚Δ

    View full-size slide

  23. ࣮ࡍʹ΍ͬͯΈͨ
    • FizzBuzzͰྫʹͯ͠Έͨ

    View full-size slide

  24. ࣮૷
    • ݟͤ·͢
    • Gistʹ͋͛·ͨ͠
    • https://gist.github.com/
    ug23/9aafd9e7666ffaa9a1aaba3640d6
    d5d8

    View full-size slide

  25. rspec࣮ߦ݁Ռ
    fizzbuzz
    indexΛදࣔจࣈྻʹม׵͢Δ
    3ͷഒ਺ͷͱ͖͸Fizz
    5ͷഒ਺ͷͱ͖͸Buzz
    15ͷഒ਺ͷͱ͖͸FizzBuzz
    3ͷഒ਺Ͱ΋5ͷഒ਺Ͱ΋ͳ͍ͱ͖͸ͦͷ··
    ग़ྗ͢Δ
    index:1ͷͱ͖ͷදࣔจࣈྻΛվߦ۠੾ΓͰඪ४ग़ྗ͢Δ
    index:15ͷͱ͖ͷදࣔจࣈྻΛվߦ۠੾ΓΛඪ४ग़ྗ͢Δ
    ճ౴͢Δ
    1͔Β100·ͰͰग़ྗ͢Δ

    View full-size slide

  26. ஫ҙ
    • ͳʹ͔ΛΞ΢τϓοτ͢Δࡍʹ

    ϚΠϯυϚοϓΛϕʔεʹ͢ΔΠϝʔδ
    • ٯ͸͋·Γߟ͍͑ͯ·ͤΜ

    ٯʹ໘౗ʹͳΔ͔΋͠Ε·ͤΜ

    • ΋ͬͱ͍͍࢖͍ํ͋Ε͹ڭ͍͑ͯͩ͘͞

    View full-size slide

  27. ·ͱΊ
    • ςετઃܭͷखஈͱͯ͠

    ϚΠϯυϚοϓΛར༻ͯ͠·͢
    • ςετઃܭͷϚΠϯυϚοϓ͕

    ͦͷ··ػೳҰཡʹͳͬͯ

    ͍Ζ͍Ζ࢖͑·͢
    • ͦͷ··RSpec΍ςετέʔεʹ

    མͱ͠ࠐΜͰ͍·͢

    View full-size slide