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

Introduction to Entering Test Design (Japanese)

Introduction to Entering Test Design (Japanese)

Takuya Matsumoto

February 17, 2017
Tweet

More Decks by Takuya Matsumoto

Other Decks in Programming

Transcript

  1. ࢲ • @upinetree (twi-er, github, qiita) • גࣜձࣾສ༿ • h-ps:/

    /www.wantedly.com/projects/10005 ʹࣸͬͯΔਓ • We are hiring ! 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 2
  2. ਅཧ஋ʢࢀߟʣ true ͔ false ͔ɻ ࿦ཧԋࢉࢠɺ੍ޚߏจʹΑΓදݱ͞ΕΔ΋ͷɻ • or, and •

    if, else, unless ୈҰ෦Ͱ͸਺஋͕ओ໾ͳͷͰࠓճऔΓѻ͍·ͤΜɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 23
  3. ಉ஋Ϋϥεςετ ͨͱ͑͹࣍ͷΑ͏ͳ࢓༷͕͋ͬͨͱ͢Δɻ 0ࡀ ʙ 18ࡀ : ޏ༻͠ͳ͍ 19ࡀ ʙ 55ࡀ

    : ޏ༻͢Δ 56ࡀ ʙ : ޏ༻͠ͳ͍ 0, 1, 2, 3, ... ͷશͯͷ೥ྸʹ͓͍ͯςετ͢Δඞཁ͕͋Δ͔ʁ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 26
  4. ಉ஋Ϋϥεςετ ͱ͸͍͑ɺ࣍ͷΑ͏ʹ࣮૷͞Ε͍ͯͨ৔߹ʹ͸΋ͪΖΜແޮɻ def hirable? if age == 0; return false;

    end if age == 1; return false; end if age == 2; return false; end # ... if age == 19; return true; end if age == 20; return true; end # ... end ͦΜͳ͜ͱ͸ͳ͍ͱئ͍͍ͨ ! 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 28
  5. ڥք஋ςετ ͨͱ͑͹ɺ࢓༷ͷڥքʹฆΕΔόά… 0ࡀ ʙ 19ࡀ : ޏ༻͠ͳ͍ 19ࡀ ʙ 55ࡀ

    : ޏ༻͢Δ 56ࡀ ʙ : ޏ༻͠ͳ͍ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 34
  6. ڥք஋ςετ ·ͨɺίʔυʹજΉຌϛε… case age when 0...19 false when 19..56 #

    <= missing dot true else false end 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 35
  7. ڥք஋ςετ ͔ͩΒڥք஋ͱɺͦͷ্͙͢ɺ΋͘͠͸͙͢Լͷ஋ʹண໨͢Δɻ • ڥք஋͕19ࡀͷͱ͖ɺண໨͢΂͖͸ {18, 19, 20} • ڥք஋͕55ࡀͷͱ͖ɺண໨͢΂͖͸ {54,

    55, 56} ҰํͰಉ஋ΫϥεςετΛࢥ͍ग़ͤ͹ɺςετ͢΂͖஋͸ಉ஋Ϋ ϥε಺Ͱͻͱ͚ͭͩͰྑ͍ɻ ͭ·Γ {18, 19, 55, 56} Ͱྑ͍ɺͱͳΔɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 37
  8. ର৅ͷ஋ͷ୯Ґ͕େࣄ • ۈ຿࣌ؒͷڥք஋ 8.00hɺখ਺ୈ2Ґ·Ͱ => {7.99, 8.00, 8.01} • ग़ۈ࣌ؒͷڥք஋͕

    10:30:00ɺඵ୯Ґ => {10:29:59, 10:30:00, 10:30:01} 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 43
  9. ͪͳΈʹ: ظؒͷڥք͸΍΍͍͜͠ ΧϨϯμʔΞϓϦͰɺ࣍ͷ2ͭͰσʔλ͸Ͳ͏࣋ͨͤΔʁ • 2/10 ʙ 2/12 ͱͨ͠ͱ͖ɺ2/12 ͸ऴ೔ؚΊ͍ͨ •

    10:00 ʙ 12:00 ͱͨ͠ͱ͖ɺ12:00:00 ͸ؚΊͨ͘ͳ͍ ೔෇ࢦఆͷ৔߹͸಺෦දݱͰ 2/10 ʙ 2/13 ͱ͢Δ౳ɺऴ୺ΛͲͪ Β͔ʹ౷Ұ͢Δ΄͏͕ѻ͍΍ͦ͢͏ɻ2 2 RFC 2445 iCalender Ͱ͸ऴ୺ΛؚΊͳ͍ํʹ౗͍ͯ͠Δ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 44
  10. 2࣠ͷڥք஋ςετ ݱ࣮ʹ͸ɺෳ਺ͷ࣠ͷڥքΛѻ͏έʔε͕΄ͱΜͲɻ ࣍ͷ࢓༷͸Ͳ͏ςετͨ͠Βྑ͍ͩΖ͏ʁ • ෦໳ίʔυ͸ ΞϧϑΝϕοτ[a-c] + ਺ࣈ[1-5] Ͱ͋Δ͜ͱ •

    ্هΛຬͨͨ͠Β trueɺຬͨ͞ͳ͔ͬͨΒ false Λฦ͢͜ͱ • ͨͱ͑͹ a1 ͸ trueɺd5 ͸ false 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 45
  11. code valid? `1 ❌ d1 ❌ a0 ❌ a6 ❌

    2࣠ͷڥք஋ςετ ҟৗܥͷڥք஋͸ʁ → ਖ਼ৗܥ΄Ͳ͸·ͱΊͯςετͰ͖ͳ͍ 1 5 a c 0 6 ` d 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 48
  12. 2࣠ͷڥք஋ςετ ϙΠϯτ: ແޮ஋͸ଞͷແޮ஋ΛӅ͢ ྫʣ d6 ͱ͍͏ςετσʔλ false ʹͳΔͷ͸ d ͕ݪҼ͔

    6 ͔͕෼͔Βͳ͍ɻ ΞϧϑΝϕοτͷνΣοΫͱ਺ࣈͷνΣοΫͲͪΒ͕ઌʹߦΘΕ Δ͔͸࣮૷࣍ୈɻ ࣮૷ґଘͷյΕ΍͍͢ςετʹͳΔ͏͑ɺยํͷਖ਼͔͠͞͠อূ Ͱ͖ͳ͍ɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 49
  13. ࣮૷ํ๏͕࣮֬ʹ૝ఆͰ͖Δ΋ͷ͸ྫ֎΋͋Γ RailsͷόϦσʔγϣϯ (ActiveModel::Varidations) ʹݶͬͯ ͸ errors ͔ΒݪҼ͕෼͔ΔͷͰແޮ஋͸ӅΕͳ͍ɻ ͨͩ͠ͻͱͭͷఆٛͰෳ਺ͷແޮ஋͕ݱΕΔ΋ͷ͸আ͘ɻ validates :code,

    format: { with: /[a-c][1-5]/ } # ਺஋ͱਅཧ஋ͷ૊Έ߹Θͤ validates :name, length: { maximum: 30 }, on: :create 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 51
  14. υϝΠϯ෼ੳςετ: ༻ޠͷ੔ཧ 10 7 in out 9 13 on off

    x >= 10 on: ڥք্ͷ஋ in: ڥք৚݅Λຬ͕ͨ͢ڥք্ʹͳ͍஋ off: ڥք৚݅Λຬͨ͞ͳ͍ɺڥքʹྡ઀͢Δ஋ out: ڥք৚݅Λຬͨ͞ͳ͍஋ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 54
  15. υϝΠϯ෼ੳςετ લड़ͷ෦໳ίʔυΛྫʹ෼ੳͯ͠ΈΔɻ • ෦໳ίʔυ͸ ΞϧϑΝϕοτ[a-c] + ਺ࣈ[1-5] Ͱ͋Δ͜ͱ • ্هΛຬͨͨ͠Β

    trueɺຬͨ͞ͳ͔ͬͨΒ false Λฦ͢͜ͱ ʮυϝΠϯςετϚτϦΫεʯͱ͍͏ͷΛॻ͍ͯ෼ੳ͢Δɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 55
  16. 1 2 3 4 5 6 7 8 [a-c] x

    >= ‘a’ on v off v x <= ‘c’ on v off v 代表値 (in | on) v v v v [1-5] x >= ‘1’ on v off v x <= ‘5’ on v off v 代表値 (in | on) v v v v 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 56
  17. 1 2 3 4 5 6 7 8 [a-c] x

    >= ‘a’ on v off v x <= ‘c’ on v off v 代表値 (in | on) v v v v [1-5] x >= ‘1’ on v off v x <= ‘5’ on v off v 代表値 (in | on) v v v v υϝΠϯ෼ੳςετ • ແޮ஋͸ଞͷແޮ஋ΛӅ͢ • ແޮ஋Λಉ࣌ʹςετ͠ͳ͍Α͏ʹɺ ยํͷม਺Λ୅ද஋ʹݻఆ͠ɺ΋͏ย ํΛมԽͤ͞Δ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 57
  18. 1 2 3 4 5 6 7 8 [a-c] x

    >= ‘a’ on v off v x <= ‘c’ on v off v 代表値 (in | on) v v v v [1-5] x >= ‘1’ on v off v x <= ‘5’ on v off v 代表値 (in | on) v v v v লུͰ͖Δςετέʔε • ಉ͡૊Έ߹Θͤ͸΍Δඞཁ͕ͳ͍ • ਖ਼ৗܥ͸޻෉࣍ୈͰҰ౓ʹςετՄೳ ୅ද஋Λ on ͱ͢Ε͹ɺ1, 3, 5, 7 ͸·ͱΊ ͯલड़ͷදͷΑ͏ʹͳΔɻ code valid? a1 ⭕ c5 ⭕ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 58
  19. ϖΞߏ੒ςετ • શͯͷ૊Έ߹ΘͤͰ͸ͳ͘ɺύϥϝʔλؒͷϖΞͰςετ • {Android + Chrome + DoCoMo} •

    {iOS + Chrome + SoftBank} • ͜ΕͰ6ͭͷϖΞΛςετͨ͜͠ͱʹͳΔ • ଟ͘ͷόά͸ɺൺֱతগ਺ͷύϥϝʔλؒͷ૬ޓ࡞༻ʹΑΓҾ ͖ى͜͞ΕΔɺͱ͍͏ܦݧଇ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 66
  20. 1 2 3 1 1 1 1 2 1 2

    2 3 2 1 2 4 2 2 1 ௚ަද ΦΠϥʔͷ࣌୅ͷϥςϯํ֨Λɺ඼࣭޻ ֶͱͯ͠ൃలͤͨ͞΋ͷɻ Ͳͷ2ྻΛͱͬͯ΋ɺͦͷ஋ͷશͯͷϖΞ ͕ಉ͡਺͚ͩݱΕΔΑ͏ʹ࡞ͬͨදɻ ӈਤ͸ ௚ަදͱݺ͹ΕΔ΋ͷͰɺ3ύ ϥϝʔλ2ਫ४ʹରԠɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 70
  21. ௚ަද͔ΒςετέʔεΛ࡞Δ 1 2 3 1 1 1 1 2 1

    2 2 3 2 1 2 4 2 2 1 OS ブラウザ キャリア 1 Android Chrome DoCoMo 2 Android Firefox SB 3 iOS Chrome SB 4 iOS Firefox DoCoMo 1ߦ໨͸ඞͣ1͕ฒͿɻ1ΛσϑΥϧτͱ͢Δͷ͕ྑ͍ɻ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 71
  22. ϖΞϫΠζ๏: PICT Microso'͕OSSͰެ։͍ͯ͠Δςετέʔεੜ੒πʔϧɻϖΞͷ ੜ੒ʹରԠ͍ͯ͠Δɻ $ cat model.txt Role: Admin, General,

    Student, Guest Theme: Black, White, Red Login method: Google, ID/PW ૯౰ΓͳΒ 4 * 3 * 2 = 24 ௨Γ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 76
  23. $ pict model.txt Role Theme Login method Student White Google

    Student Black ID/PW Guest Black Google Student Red Google Admin White ID/PW General White ID/PW General Black Google Guest Red ID/PW Admin Red Google Admin Black ID/PW General Red ID/PW Guest White Google 12௨Γ (50%) ʹ཈͑ΒΕͨʂ 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 77
  24. Copyrights h"ps:/ /flic.kr/p/gDqtze h"ps:/ /flic.kr/p/9Sgawd h"ps:/ /flic.kr/p/QFzL4S h"ps:/ /flic.kr/p/9P1ebv h"ps:/

    /flic.kr/p/x1qSv h"ps:/ /flic.kr/p/baoynZ h"ps:/ /flic.kr/p/aDPTFx 2017-02-17 גࣜձࣾສ༿ ؼࣾ೔ 87