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

Web testing strategy

Web testing strategy

110cd4dcaed019b3bd9809e541afdeb6?s=128

Masafumi Okura

June 26, 2019
Tweet

Transcript

  1. Web։ൃʹ͓͚Δ ςετઓུ Place: ΏΔ͸ͪ.it Date: 2019-06-26 Speaker: େ૔խ࢙

  2. ͸͡Ίʹ

  3. ςετͷ༻ޠΛ੔ཧͯ͠ΈΔ

  4. ࢲՈ൛ςετ༻ޠू • E2EςετɿϢʔβʔΠϯλʔϑΣΠε͔Β σʔλϕʔε·ͰΛҰ؏͢ΔςετɺγφϦΦ Λ༻ҙͯ͠ਐΊΔ৔߹͕ଟ͍ɺผ໊γεςϜς ετ • ݁߹ςετɿෳ਺ͷίϯϙʔωϯτΛ݁߹͠ ͯߦ͏ςετɺػೳ୯ҐͰߦΘΕΔ৔߹͕ଟ ͘ϑΟʔνϟʔςετ͸͜ͷҰछ

  5. ࢲՈ൛ςετ༻ޠूʢଓʣ • Ϣχοτςετɿ୯Ұͷιϑτ΢ΣΞίϯϙʔ ωϯτͷΈΛର৅ͱͨ͠ςετɺݱ࣮తʹ͸୯ ҰͷϑΝΠϧΛର৅ͱ͢Δ৔߹͕ଟ͘ɺର৅ʹ Αͬͯݺͼ໊΋มΘΔʢϞσϧςετɾϏϡʔ ςετͳͲʣ • ςετμϒϧɿςετதʹίϯϙʔωϯτΛஔ ͖׵͑Δ୅༻඼ʢελϒɾϞοΫɾεύΠͳͲʣ

  6. ςετΛॻ͍ͯԿ͕خ͍͠ Ͱ͔͢ʁ

  7. όάͷݮগʁ

  8. ҆৺ײʁ

  9. ։ൃऀͷ޾෱ʁ

  10. ։ൃऀͷ޾෱ʂ

  11. ͲͷΑ͏ʹςετΛॻ͘ͱɺ ։ൃऀͷ޾͕ͤ࠷େԽ͞ΕΔ ͷ͔

  12. ϓϩάϥϚͷࡾେඒಙ

  13. ϓϩάϥϚͷࡾେඒಙ • ୹ؾ • ၗຫ • ଵଦ

  14. ςετͷࡾେඒಙ • ଎͍ • ίʔυͷઃܭΛิॿ͢Δ • ϓϩμΫγϣϯίʔυͷมߋʹৼΓճ͞Εͳ ͍

  15. ଎͍ςετ

  16. ଎͍ςετͷͨΊͷํ਑ • E2Eςετ͸ਖ਼ৗܥͷΈʢҟৗܥ͸Ϣχοτς ετͰΧόʔ͢Δʣ • DB΁ͷΞΫηεΛՄೳͳݶΓݮΒ͢ • ͱͯ΋ॏ͍ॲཧ͸ςετμϒϧʹஔ͖׵͑Δ

  17. ϖʔδωʔγϣϯͷ۩ମྫ # Bad @books = create_list(:book, 11) visit books_url expect(page).not_to

    have_content(‘Book11’) # Good @book = create_list(:book, 2) PER_PAGE = 1 # తͳ΍ͭ visit books_url expect(page).not_to have_content(‘Book2’)
  18. ઃܭπʔϧͱͯ͠ͷςετ

  19. ςετͰઃܭ͢ΔͨΊʹ • ݪଇɺςετΛઌʹॻ͘ʢςετϑΝʔετʣ • ςετ͕௕͗͢Δɾෳࡶ͗͢Δɾ೉͗͢͠Δ ৔߹͸ϓϩμΫγϣϯίʔυͷ࠶ઃܭΛݕ౼ • ςετ಺ʹςετμϒϧ͕ଟ͗͢Δ৔߹͸ґ ଘؔ܎Λݟ௚͢

  20. ςετ͕ࠔ೉ͳίʔυྫ # foo.rb class Foo def do_something(arg1, arg2, arg3 =

    nil, params = {}) end end # foo_spec.rb context ‘when arg1 is :hoge’ do context ‘when arg2 is…
  21. ςετ͕༰қͳίʔυྫ # foo.rb class Foo def do_something(arg1) bar.do_another(arg2) end end

    # foo_spec.rb context ‘when arg1 is :hoge’ do before { allow(bar).to receive(:do_another) { hoge }
  22. มߋʹڧ͍ςετ

  23. ςετ΋ίʔυ • ݪଇɺύϒϦοΫͳΠϯλʔϑΣΠεͷΈΛ ςετ͢Δ • Ϗϡʔ͸ςετ͠ͳ͍ʢมԽ͕଎͍͔ΒɺͲ ͏ͯ͠΋͚ͨ͠Ε͹E2EͰʣ • ςετର৅ͷ಺෦ঢ়ଶ͸஌ͬͯ͸͍͚ͳ͍ ʢΠϯελϯεม਺ͱ͔ʣ

  24. ͍͞͝ʹ

  25. ࣗಈςετ͸։ൃऀͷͨΊͷ πʔϧ

  26. ςετ͕΋ͨΒ͢޾෱౓Λ ࠷େԽ͍͖·͠ΐ͏

  27. ͱ͜ΖͰɿ

  28. ͋Μͨ୭ʁ

  29. ࣗݾ঺հ • ໊લɿେ૔խ࢙ • ॴଐɿϑϦʔϥϯε • ޷͖ͳݴޠɿRuby • ޷͖ͳΤσΟλɿVim