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

Goのテストの基本と開発フロー

 Goのテストの基本と開発フロー

標準パッケージと小さいツールの組み合わせで十分テストできますよ的な話 @GolangTestNight(Gunosy.go#10)

05e8adce66be4e80390a29ace0075161?s=128

y_matsuwitter

September 11, 2014
Tweet

Transcript

  1. (Pͷςετͷجຊͱ ։ൃϑϩʔ !Z@NBUTVXJUUFS

  2. !Z@NBUTVXJUUFS w (VOPTZJOD ࣥߦ໾һ w ศར԰ w ਖ਼࠲POόϥϯεϘʔϧ w (PMBOH

    w झຯ͸੡໙ۀ
  3. ΞδΣϯμ w ιϑτ΢ΣΞςετͱ(Pݴޠͷࢥ૝ w UFTUJOHύοέʔδͷ঺հ w ςετΛؚΊ࣮ͨࡍͷ։ൃϑϩʔͷҰྫ

  4. օ͞Μ(Pॻ͍ͯ·͔͢ʁ

  5. (Pͷςετͯ͠·͔͢ʁ

  6. ͦ΋ͦ΋ςετͱ͸ w ػೳʹόά͕ແ͍͜ͱΛ֬ೝ͢Δʢػೳཁ݅ʣ w αʔϏεͷ඼࣭Λ֬ೝ͢Δʢඇػೳཁ݅ʣ

  7. ػೳཁ݅ w ίʔυ͕ຬͨ͢΂͖࢓༷ʹ͍ͦͬͯΔ͜ͱ w શͯͷೖྗ஋ʹରͯ͠ɺద੾ʹॲཧͰ͖͍ͯΔ ͜ͱ

  8. ඇػೳཁ݅ w ੑೳ͕े෼Ͱ͋Δ͜ͱ w ηΩϡϦςΟʹ໰୊͕ͳ͍͜ͱɹɹʜͳͲͳͲ

  9. ςετ͸ ͦΕ͚ͩͰ͸ͳ͍

  10. ςετͱνʔϜ։ൃ w Ϟδϡʔϧͷಠཱੑ͕୲อ͠΍͍͢ w ଐਓੑͷഉআ

  11. 5FTUBCMFͳϞδϡʔϧ w ֎෦ͷଞͷϞδϡʔϧʹґଘ͠ͳ͍ w ෭࡞༻͕গͳ͍

  12. ଐਓੑͷഉআ w ςετ͕࢓༷ॻ w ॻ͍ͨίʔυ΍ϦϑΝΫλͨ͠ίʔυͷଥ౰ੑ ͕ͩΕͰ΋ݕূͰ͖Δ

  13. (Pͷςετࢥ૝ w /P"TTFSUJPO w /PUFTUIFMQFS

  14. 8IZOPBTTFSUJPO w l1SPQFSFSSPSIBOEMJOHNFBOTUIBUTFSWFST DPOUJOVFPQFSBUJPOBGUFSOPOGBUBMFSSPST JOTUFBEPGDSBTIJOHz w l1SPQFSFSSPSSFQPSUJOHNFBOTUIBUFSSPST BSFEJSFDUBOEUPUIFQPJOU TBWJOHUIF QSPHSBNNFSGSPNJOUFSQSFUJOHBMBSHF

    DSBTIUSBDFz
  15. ͬ͘͟Γݴ͏ͱ w "TTFSUJPOͰॲཧΛதஅ͢ΔΑΓ΋ɺΫϥογϡ ͤ͞ͳ͍͜ͱΛ༏ઌ w ద੾ͳΤϥʔϨϙʔτ͕େ੾

  16. 8IZOPUFTUIFMQFST w l"SFMBUFEQPJOUJTUIBUUFTUJOHGSBNFXPSLT UFOEUPEFWFMPQJOUPNJOJMBOHVBHFTPGUIFJS PXO XJUIDPOEJUJPOBMTBOEDPOUSPMTBOE QSJOUJOHNFDIBOJTNT CVU(PBMSFBEZIBTBMM UIPTFDBQBCJMJUJFTXIZSFDSFBUFUIFN z

  17. ͬ͘͟Γݴ͏ͱ w (Pݴޠࣗମʹςετʹؔ͢Δॆ෼ͳࢧԉػߏ͕ උΘ͍ͬͯΔͷͰɺ৽ͨͳ%4-ͳͲͷशಘʹί ετΛׂ͔ͣʹςετ͢Δ͜ͱΛ͓͢͢Ί͢Δ

  18. (PMBOHͰͷఆੴ w l5IFUFTUNJHIUXPSLCFUUFSJGUBCMFESJWFOz w ਖ਼͍͠ೖྗͱग़ྗͷ૊Λ࠷ॳʹ༻ҙ͠ɺͦΕΒ ͕୲อ͞Ε͍ͯΔ͔νΣοΫ͍ͯ͘͠

  19. UFTUJOHύοέʔδ

  20. جຊ w HPUFTUίϚϯυΛ࣮ߦ͢Δͱɺ @UFTUHPϑΝΠ ϧ͕શͯςετ࣮ߦର৅ͱͯ͠ςετ։࢝ w ςετର৅ϝιουΛߜΔͳͲࡉ͔͍༷ʑͳΦ ϓγϣϯ͕͋Γ·͢

  21. ҎԼͷίʔυΛϕʔεʹύοέʔδ঺հ QBDLBHFNBJO ! GVOD%PVCMF JJOU JOU\  SFUVSOJ  ^

  22. 5FTUܥ

  23. None
  24. ΍Δ͜ͱ w GVOD5FTU U UFTUJOH5 Λ࣮૷ w U-PH U&SSPS U'BUBMͳͲΛ༻͍ɺςετͷࣦഊ

    ͳͲΛద੾ͳϑΥʔϚοτͰ఻͑Δ w ࣮ߦHPUFTU
  25. #FODINBSLܥ

  26. None
  27. ΍Δ͜ͱ w GVOD#FODINBSL U UFTUJOH# Λ࣮૷ w C/ C3VO1BSBSFMM C3FTUBSU5JNFSͳͲΛ༻͍ɺ

    ϕϯνϚʔΫΛਖ਼͘͠૸ΒͤΔ͜ͱɻ w ࣮ߦHPUFTUCFODI
  28. &YBNQMFܥ

  29. None
  30. ΍Δ͜ͱ w GVOD&YBNQMF Λ࣮૷ w GVODͷ຤ඌʹ0VUQVU͔Β࢝·Δɺظ଴͞Ε Δඪ४ग़ྗΛίϝϯτͱͯ͠ॻ͖ࠐΉ w ࣮ࡍͷඪ४ग़ྗͱίϝϯτΛൺֱ͢Δ w

    ࣮ߦHPUFTU
  31. $BTF4UVEZ Ϟμϯͳ ։ൃϑϩʔߏங

  32. ͓୊ w 6TFS"HFOUΛೖྗ͢ΔͱJ1IPOF "OESPJE ͦ ͷଞͷ͍ͣΕ͔Λฦͯ͘͠ΕΔϞδϡʔϧΛ࡞Δ

  33. ͱΓ͋͑ͣ ͬ͘͟Γ֎࿮Λ࡞Δ

  34. None
  35. EPDHP HPEPDʹͯɺύοέʔδ಺ͷEPDHP͸0WFSWJFXͳͲͰ ར༻͞ΕΔͷͰɺॻ͍ͯΈ·͠ΐ͏ɻ

  36. (P%PDΛग़ྗ͢Δ w HPEPDIUUQb` w (JUIVCͳͲͷ1VCMJD3FQPͳΒHPEPDPSHͰ֬ ೝͰ͖·͢ w IUUQTHPEPDPSHHJUIVCDPNZ NBUTVXJUUFSEFWJDFUZQF

  37. None
  38. ςετΛॻ͘

  39. None
  40. &YBNQMF

  41. #FODINBSL

  42. ςετΛ࣮ߦͯ͠ΈΔ

  43. $PWFSBHFϨϙʔτ ҎԼͷίϚϯυͰ֬ೝͰ͖Δ HPUFTUDPWFSQSPpMFDPWFSBHFPVU HPUPPMDPWFSBHFIUNMDPWFSBHFPVU

  44. $*αʔϏεʹ௥Ճ w $JSDMF$*Ͱ͋Ε͹࿈ܞ͢Δͩ ͚Ͱ0, w ౰વίέΔ w IUUQTDJSDMFDJDPNHIZ NBUTVXJUUFSEFWJDFUZQF

  45. αϯϓϧ͸ͪ͜Β w ϦϙδτϦIUUQTHJUIVCDPNZ NBUTVXJUUFSEFWJDFUZQF w $JSDMF$*IUUQTDJSDMFDJDPNHIZ NBUTVXJUUFSEFWJDFUZQF w (P%PDIUUQTHPEPDPSHHJUIVCDPNZ NBUTVXJUUFSEFWJDFUZQF

  46. ·ͱΊ w ςετέʔεʹ߹ΘͤͯͦΕͧΕʹద੾ͳςετ Λߏங͢Δ͜ͱ͕(PͰ͸ਪ঑͞Ε͍ͯΔɻ w (PݴޠͳΒେ͖ͳϑϨʔϜϫʔΫΛಋೖ͢Δ͜ ͱͳ͘ɺϞμϯͳ։ൃϑϩʔ͕ߏஙͰ͖Δʂ

  47. )BQQZ(PDPEJOH