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

COOKPAD and Test Automation

COOKPAD and Test Automation

ソフトウェアテストシンポジウム 2014 東北(JaSST'14 Tohoku)
2014年5月23日(金)

Naoto Takai

May 25, 2014
Tweet

More Decks by Naoto Takai

Other Decks in Programming

Transcript

  1. ΫοΫύουͱςετࣗಈԽ
    JaSST’14 Tohoku

    View full-size slide

  2. ߴҪ௚ਓ
    ΫοΫύουגࣜձࣾ

    View full-size slide

  3. ࢲͷཤྺॻ
    ೥ʙ ϝʔΧʔܥൢࣾ

    ೥ʙ ΢Σϒ੍࡞ձࣾ

    ೥ʙ େखγεςϜΠϯςάϨʔλʔ

    ೥ʙ ωοταʔϏεӡӦձࣾ

    View full-size slide

  4. ιϑτ΢ΣΞ඼࣭ͱͷग़ձ͍
    ΢Σϒ੍࡞ձࣾͰडୗ։ൃʹैࣄ͍ͯͨ͠
    ࢲ͸3VCZͷීٴɾൃలͷͨΊʹେखγε
    ςϜΠϯςάϨʔλ΁ͱస৬ͨ͠ͷ͕ͩɺ
    ԿͷҼՌ͔ιϑτ΢ΣΞඪ४Խ෦໳ʹ഑ଐ
    ͞ΕΔ͜ͱʹͳͬͨͷͩͬͨʜʜɻ

    View full-size slide

  5. ݄ؒϢχʔΫϒϥ΢β਺






    ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄ ݄
    1$
    ϞόΠϧ ສ6#
    ʢ೥݄ظୈ࢛൒ظܾࢉิ଍આ໌ࢿྉʣ

    View full-size slide

  6. εϚϗΞϓϦྦྷܭ%-਺
    ύζυϥ ສɺࠇೣ ສ
    J04 ສ "OESPJEສ
    ʢ೥݄࣌఺ʣ

    View full-size slide

  7. ౤ߘϨγϐ਺







    ݄ ݄ ݄ ݄ ݄ ݄ ݄
    Ϩγϐ਺
    ສ඼
    ʢ೥݄ظୈ࢛൒ظܾࢉิ଍આ໌ࢿྉʣ

    View full-size slide

  8. ΫοΫύουͷϢʔβʔ
    உੑ

    ঁੑ

    ঁੑ
    உੑ
    ੑผ
    ୅Ҏ্







    ୅ҎԼ

    ୅ҎԼ



    ୅Ҏ্
    ೥୅ʢঁੑʣ
    ʢ೥݄࣌఺ʣ

    View full-size slide

  9. .
    .
    .
    .
    .
    2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
    ձһࣄۀ
    ޿ࠂࣄۀ
    ͦͷଞ
    ࢛൒ظച্ߴ
    ඦສԁʢ࿈݁ʣ
    ʢ೥݄ظୈ࢛൒ظܾࢉิ଍આ໌ࢿྉʣ

    View full-size slide

  10. ΞϓϦέʔγϣϯߏ੒ʢ8FCʣ
    MySQL
    Redis
    Memcached
    Unicorn
    Rails 3.2
    Ruby 2.0
    nginx
    Amazon Web Service
    Apache

    View full-size slide

  11. ΞϓϦέʔγϣϯن໛ʢ8FCʣ
    w Ϟσϧɹɹɹɹɹɹɹʜ Ϋϥε
    w ίϯτϩʔϥʔɹɹɹʜΫϥε
    w ϏϡʔςϯϓϨʔτɹʜ ϑΝΠϧ
    w ϧʔςΟϯάఆٛɹɹʜ ߦ
    w 34QFD&YBNQMF਺ɹɹʜ ݸ
    w σϓϩΠճ਺ɹɹɹɹʜճҎ্ʗ೔
    ʢ೥݄೔࣌఺ʣ

    View full-size slide

  12. ࠷ߴʹ͓͍͍͠ʮνϣίϨʔτέʔΩʯ͸
    Ͳ͏΍ͬͨΒͰ͖Δ͔Λߟ͍͑ͯͩ͘͞ɻ

    View full-size slide

  13. ʮຖ೔ͷྉཧΛָ͠Έʹʯ͸
    Ͳ͏΍ͬͨΒͰ͖Δ͔Λߟ͍͑ͯͩ͘͞ɻ

    View full-size slide

  14. ࣦഊ͢Δ΍Γํ
    ָ͠ΈʹͳΔͨΊͷཁ݅Λఆٛ͢Δ
    ্هΛຬͨ͢ػೳΛઃܭ͢Δ
    ιϑτ΢ΣΞΛ࣮૷͠ɺςετ͢Δ

    View full-size slide

  15. ͳࣦͥഊ͢Δͷ͔ʁ
    ָ͠ΈʹͳΔͨΊͷཁ݅Λఆٛ͢Δ
    ্هΛຬͨ͢ػೳΛઃܭ͢Δ
    ιϑτ΢ΣΞΛ࣮૷͠ɺςετ͢Δ
    ʮଥ౰ੑ֬ೝʯͷϓϩηε͕ͳ͍

    View full-size slide

  16. ̫ˍ̫ʢݕূͱଥ౰ੑ֬ೝʣ
    w ݕূ

    ٬؍తূڌΛఏࣔ͢Δ͜ͱʹΑͬͯɺنఆཁٻࣄ߲
    ͕ຬͨ͞Ε͍ͯΔ͜ͱΛ֬ೝ͢Δ͜ͱɻ
    w ଥ౰ੑ֬ೝ

    ٬؍తূڌΛఏࣔ͢Δ͜ͱʹΑͬͯɺಛఆͷҙਤ͞
    Εͨ༻్ຢ͸ద༻ʹؔ͢Δཁٻࣄ߲͕ຬͨ͞Ε͍ͯ
    Δ͜ͱΛ֬ೝ͢Δ͜ͱɻ

    View full-size slide

  17. ̫ࣈϞσϧͱ̫ˍ̫
    ଥ౰ੑ֬ೝ
    ཁ݅ఆٛ
    جຊઃܭ
    ৄࡉઃܭ
    ࣮૷ɾ୯ମςετ
    ݁߹ςετ
    γεςϜςετ
    ड͚ೖΕςετ
    اը ධՁ
    ݕূ

    View full-size slide

  18. ̫ࣈϞσϧͱ੹೚෼ք఺ʢ༨ஊʣ
    ൃ஫ଆൣғ
    ཁ݅ఆٛ
    جຊઃܭ
    ৄࡉઃܭ
    ࣮૷ɾ୯ମςετ
    ݁߹ςετ
    γεςϜςετ
    ड͚ೖΕςετ
    اը ධՁ
    डୗଆൣғ
    डୗ։ൃͰଥ౰ੑ֬ೝ͕
    ࿩୊ʹͳΒͳ͍ཧ༝
    ਖ਼֬ʹ͸ཁ݅ఆٛɾड͚ೖ
    Εςετ͸ൃ஫ଆ੹೚

    View full-size slide

  19. ੒ޭ͢Δ΍Γํ
    ιϑτ΢ΣΞΛ͔ͭͬͯ΋Β͏
    ָ͠Έʹͳ͔ͬͨΛௐ΂Δ
    Ͳ͏΍ͬͨΒ΋ͬͱָ͠ΈʹͳΔ
    ιϑτ΢ΣΞΛͭ͘ΕΔ͔ߟ͑Δ

    View full-size slide

  20. σΠϒɾτʔϚεᐌ͘ɺ
    " 8IFSFEPXFXBOUUPCF
    # 8IFSFBSFXF
    $ )PXEPXFJNQSPWFPVSQSPDFTT
    5IJTJT"HJMJUZ5IFSFJTOPNPSF

    View full-size slide

  21. ཁٻຬ଍ͷࣄޙੑ
    ιϑτ΢ΣΞ͕ཁٻΛຬ͍ͨͯ͠Δ͔͸ɺ
    ιϑτ΢ΣΞΛ࢖Θͳ͍ͱ൑அͰ͖ͳ͍ɻ

    View full-size slide

  22. ΋͠ɺ͓٬͞·ʹ๬Ή΋ͷΛฉ͍͍ͯͨΒɺ
    ͓٬͞·͸ʮ΋ͬͱ଎͍അ͕ཉ͍͠ʯͱ

    ౴͍͑ͯͨͩΖ͏ɻ
    ϔϯϦʔɾϑΥʔυʦཁग़యʧ

    View full-size slide

  23. ୭͕ސ٬ͳͷ͔͕Θ͔Βͳ͚Ε͹ɺԿ͕඼
    ࣭ͳͷ͔΋Θ͔Βͳ͍ɻ
    ΤϦοΫɾϦʔεʰϦʔϯελʔτΞοϓʱ
    ඼࣭͸୭͔ʹͱͬͯͷՁ஋Ͱ͋Δɻ
    δΣϥϧυɾϫΠϯόʔάʰιϑτ΢ΣΞจԽΛ૑Δ̍ʱ

    View full-size slide

  24. ߏங͢Δ
    ܭଌ͢Δ
    ֶͿ
    ੡඼
    σʔλ
    ΞΠσΞ
    ߏஙɾܭଌɾֶशͷϧʔϓ
    ͜ͷϧʔϓʹཁ͢Δ࣌ؒΛ࠷খԽ͢Δ

    View full-size slide

  25. ϧʔϓʹཁ͢Δ࣌ؒΛ࠷খԽ͢Δʹ͸ʁ
    ʢʹιϑτ΢ΣΞͷͭ͘Γํͷվળʣ

    View full-size slide

  26. ࣦഊ͢Δ΍Γํ
    ։ൃϓϩηεඪ४Λఆٛ͢Δɻ
    ։ൃϓϩηεඪ४ΛϓϩδΣΫτຖʹ
    ςʔϥϦϯά͢Δɻ

    View full-size slide

  27. ͳࣦͥഊ͢Δͷ͔ʁ
    ։ൃϓϩηεඪ४Λఆٛ͢Δɻ
    ։ൃϓϩηεඪ४ΛϓϩδΣΫτຖʹ
    ςʔϥϦϯά͢Δɻ
    ݱ࣮ͷ։ൃϓϩηεͷվળͰ͸ͳ͍

    View full-size slide

  28. ੒ޭ͢Δ΍Γํ
    ϦϦʔεՄೳͳঢ়ଶʹ͢Δ
    ιϑτ΢ΣΞΛ։ൃ͢Δ
    มߋΛՃ͔͑ͯΒϦϦʔεՄೳͳ
    ঢ়ଶʹͳΔ·ͰͷແବΛͳ͘͢

    View full-size slide

  29. ιϑτ΢ΣΞੜ࢈ੑ
    ιϑτ΢ΣΞͷੜ࢈ੑΛ޲্ͤ͞ΔͨΊͷ
    ޮՌతͳख๏͸͓Αͦࡾͭʹ෼ྨ͞ΕΔɻ
    w ෦඼Խʜͭ͘Βͳ͍Α͏ʹ͢Δ
    w ࣗಈԽʜ͠ͳ͍Α͏ʹ͢Δ
    w ՄࢹԽʜΘ͔ΔΑ͏ʹ͢Δ

    View full-size slide

  30. ܧଓతσϦόϦʔ
    ܧଓతσϦόϦʔ͸ιϑτ΢ΣΞ։ൃʹ͓
    ͚Δن཯ͷͻͱͭͩɻʜʜܧଓతσϦό
    ϦʔΛ࣮ݱ͢Δʹ͸ɺ։ൃνʔϜ͕ιϑτ
    ΢ΣΞΛܧଓతʹ౷߹͠ɺ࣮ߦϑΝΠϧΛ
    Ϗϧυ͠ɺ͞ΒʹͦΕΛࣗಈతʹςετ
    ͯ͠໰୊Λݕग़͢Ε͹͍͍ɻ
    IUUQDBQTDUSMRVFKQLENTOSXJLJCMJLJ $POUJOVPVT%FMJWFSZ

    View full-size slide

  31. ࣗಈςετͱඅ༻ରޮՌʢ༨ஊʣ
    ςετࣗಈԽ͸։ൃϓϩηεͷϜμऔΓͰ
    ͋Γɺͦ΋ͦ΋ϜμऔΓʹඅ༻ରޮՌͱ͍
    ͏֓೦͸͏·Εͳ͍ʢΩϦοʣ

    View full-size slide

  32. σϓϩΠϝϯτύΠϓϥΠϯ
    ੒Ռ෺ϦϙδτϦ
    όʔδϣϯίϯτϩʔϧ
    ιʔείʔυ ઃఆ
    ίϛοτεςʔδ ड͚ೖΕεςʔδ
    ड͚ೖΕςετ
    ؀ڥઃఆɺσϓϩΠɺ
    εϞʔΫςετ
    ੑೳςετ
    ؀ڥઃఆɺσϓϩΠɺ
    εϞʔΫςετ
    ຊ൪؀ڥ
    ؀ڥઃఆɺσϓϩΠɺ
    εϞʔΫςετ
    ίϯύΠϧ
    ίϛοτςετ
    ੒Ռ෺࡞੒
    ίʔυղੳ
    ؀ڥઃఆ
    σϓϩΠ
    εϞʔΫςετ
    ड͚ೖΕςετ
    ઃఆ
    +F[)VNCMFɺ%BWJE'BSMFZʰܧଓతσϦόϦʔʱ

    View full-size slide

  33. ΫοΫύουͷύΠϓϥΠϯ
    Source Code Review
    Continuous Integration
    Production Test
    Developement
    Production
    GitHub Git Repository
    merge
    pull req
    pull
    tag
    deploy
    deploy

    View full-size slide

  34. Developer Machine
    Redis
    Shared Development MySQL
    EC2
    Ruby on Rails
    memcached
    Remote Spec Workers
    remote_spec worker
    remote_spec worker

    GitHub Enterprise
    LAN
    Tokyo Tyrant
    Development App Server
    push
    rspec
    deploy
    HipChat
    ϩʔΧϧͷ։ൃ؀ڥ

    View full-size slide

  35. ։ൃऀʹΑΔςετ
    34QFDʹΑΔςετ

    ୯ମςετπʔϧʹΑͬͯɺσʔλϕ
    ʔε΋ؚΊͨςετΛ͢Δ
    $BQZCBSBʹΑΔςετ

    ը໘ͳ͠ͷ΢Σϒϒϥ΢βΛ༻͍ͯɺ
    γφϦΦϕʔεͷςετΛ͢Δ

    View full-size slide

  36. ։ൃऀςετɾ2"ςετʢ༨ஊʣ
    ։ൃऀςετͱ2"ςετ͸ରཱతͳ֓೦
    Ͱ͸ͳ͘ɺςετͷ͋Δଆ໘ʹ͗͢ͳ͍ɻ
    ෼ྨ͋Γ͖Ͱߟ͑ΔͷͰ͸ͳ͘ɺϦϦʔε
    ·ͰʹԿ͕ඞཁ͔Λߟ͑Α͏ɻ

    View full-size slide

  37. 34QFDͷಛ௃
    ;Δ·͍ۦಈ։ൃʢ#%%ʣͷͨΊͷςες
    ΟϯάϑϨʔϜϫʔΫɻ
    w σϑΝΫτελϯμʔυͰ͋Δ
    w ςετίʔυΛߏ଄Խ͠΍͍͢
    w ΤίγεςϜ͕ॆ࣮͍ͯ͠Δ

    View full-size slide

  38. 34QFDʹΑΔςετ
    describe SymbolStack do
    ...
    context 'when stack is empty' do
    subject(:empty_stack) { SymbolStack.new }
    describe '#size' do
    it { expect(empty_stack.size).to eq 0 }
    end

    View full-size slide

  39. $BQZCBSBʹΑΔςετ
    feature 'User login' do
    scenario 'successful login' do
    visit login_path
    fill_in 'Login', with: '[email protected]'
    fill_in 'Password', with: 'password'
    click_link 'Submit'
    expect(current_path).to root_path
    end

    View full-size slide

  40. LAN
    EC2
    CI Server
    Git Repository Production Test
    HipChat
    tag
    pull
    notify
    deploy
    Development DB
    schema
    Remote Spec
    distribute
    Git Repository
    clone pusher
    service hook pull
    push
    Developer
    merge
    ιʔείʔυͷྲྀΕ

    View full-size slide

  41. ίʔυϨϏϡʔ
    Team
    Pull Request
    Owner Developer
    Developer
    review
    open merge
    review
    ίʔυϨϏϡʔ͸νʔϜ୯ҐͰߦͳ͏͕ɺ
    શһ͕ϨϏϡʔ͢Δ͜ͱ΋Ͱ͖Δɻ

    View full-size slide

  42. Repository
    Product Support
    Product Manager
    Issue
    Developer UI/UX Designer
    Pull Request
    file
    file
    review
    open
    open
    (JU)VC&OUFSQSJTFͷར༻
    ΤϯδχΞҎ֎ʹ΋σβΠφʔ৬ɺσΟϨ
    Ϋλʔ৬ɺαϙʔτ৬ͳͲ

    View full-size slide

  43. LAN
    EC2
    CI Server
    Git Repository Production Test
    HipChat
    tag
    pull
    notify
    deploy
    Development DB
    schema
    Remote Spec
    distribute
    Git Repository
    clone pusher
    service hook pull
    push
    Developer
    merge
    ιʔείʔυͷྲྀΕ

    View full-size slide

  44. $*αʔόʮ͓Ή͖Μ͢ʯ
    IUUQTHJUIVCDPNNBTBOPCVJNBJFNPUJPOBMKFOLJOTQMVHJO

    View full-size slide

  45. $*࣌ؒʹؔ͢Δܦݧଇ
    ։ൃऀ͸े෼ʹၗຫͳͷͰɺ
    ෼ͰΠϥΠϥ͠ɺ෼ͰΩϨΔɻ

    View full-size slide

  46. $*Λૣ͘͢Δ޻෉
    ϚϧνϓϩηεԽʢQBSBMMFM@UFTUTʣ
    ෼ࢄԽ
    ୈ̍ੈ୅SFNPUF@TQFD
    ୈ̎ੈ୅SFNPUF@TQFD
    ୈ̏ੈ୅3334QFD

    View full-size slide

  47. 3334QFDͷಛ௃
    εϙοτΠϯελϯεΛར༻
    ϓϩηεఀࢭ͔Βͷࣗಈ෮ؼ
    ࣦഊͨ͠ςετͷࣗಈ࠶࣮ߦ
    ςετ࣮ߦॱংͷ࠷దԽ
    ௕͍ςετͷ౤ػత࣮ߦ
    Φʔϓϯιʔε
    IUUQTHJUIVCDPNDPPLQBESSSTQFDCMPCNBTUFS%&4*(/NE

    View full-size slide

  48. Master
    Slave
    Worker
    Slave
    Slave
    Worker
    ʜ ʜ
    DB
    3334QFDͷߏ੒
    &YBNQMF਺ʜ໿
    εϨʔϒ਺ʜ໿୆
    ϫʔΧʔ਺ʜ໿ฒྻ
    ࣮ߦ࣌ؒɹʜ໿෼

    View full-size slide

  49. ςετͷ඼࣭
    ػೳͷՁ஋͸ϦϦʔεͯ͠ॳΊͯΘ͔Δ
    ʹςετʹա৒ͳઌߦ౤ࢿ͸Ͱ͖ͳ͍
    w ςετઃܭ޻ఔΛಠཱͯ͠ઃ͚ͳ͍
    w ։ൃ޻ఔͷ͋ͱͷςετ޻ఔ͸ͳ͍
    ຊ൪؀ڥͰͷμϝʔδίϯτϩʔϧ͕ॏཁ

    View full-size slide

  50. σϕϩούʔͱϢʔβʔͷίϛϡχέʔγ
    ϣϯ΍ίϥϘϨʔγϣϯΛ્Ήน΋ͳ͘ͳ
    ͬͨɻόάͷण໋͸ɺ਺ϲ݄͔Β਺෼ʹ୹
    ॖ͞Εͨɻ
    ̟ɾ΢ΟςΧʔɺ̟ɾΞʔϘϯɺ̟ɾΩϟϩʔϩ

    ʰςετ͔Βݟ͑ͯ͘Δάʔάϧͷιϑτ΢ΣΞ։ൃʱ

    View full-size slide

  51. ͱɺ͍͏͓࿩ͩͬͨͷ͞ʜʜ

    View full-size slide

  52. ϞόΠϧΞϓϦέʔγϣϯ
    w ΑΓϢʔβʔΤΫεϖϦΤϯε͕ॏཁʹ
    w Ϧονͳ6*ɺෳࡶͳঢ়ଶͷςετ
    w ΞϓϦέʔγϣϯσϦόϦʔ໰୊͕࠶೩
    w ෳ਺όʔδϣϯ͕ซଘ
    w ϦϦʔεϑϩʔͷ࠶ߏங
    w ϦϦʔεظؒɺςετϑΣʔζ

    View full-size slide

  53. ෮श໰୊
    ສճʹճɺສԁ͕౰ͨΔεϩοτϚ
    γϯ͕͋Δ΋ͷͱ͠·͢ɻ͜ͷεϩοτϚ
    γϯͰ༡Ϳͱ͖ɺճ͋ͨΓ͍͘Βίετ
    Λ͔͚Δ΂͖͔ߟ͍͑ͯͩ͘͞ɻ

    View full-size slide

  54. ·ͱΊ
    w Ϣʔβʔͷཁٻ͸ɺϦϦʔεͯ͠ॳΊͯ
    ෼͔Δɻ
    w ߏஙɾܭଌɾֶशͷϧʔϓʹཁ͢Δ࣌ؒ
    Λ࠷খԽ͠ͳ͚Ε͹ͳΒͳ͍ɻ
    w ϦϦʔε·ͰͷϓϩηεΛఆٛ͠ɺͦ͜
    ͔ΒແବΛऔΓআ͘ɻ

    View full-size slide