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

test-queueによるテスト高速化

 test-queueによるテスト高速化

VASILY TECH MTG vol.3のブラウザチームによる発表のスライドです。

AmatsukiKu

August 14, 2015
Tweet

More Decks by AmatsukiKu

Other Decks in Programming

Transcript

  1. ςετͷߴ଎Խ
    ʙ test-queueΛ࢖ͬͨฒྻԽ ʙ
    VASILY TECH MTG vol.3 2015/08/17
    Browser Team: Gonnokami

    View full-size slide

  2. લճ͸ɺ
    ςετॻ͖΍ͨ͘͢͠
    describe "GET :pref_list" do
    before do
    request.env["HTTP_USER_AGENT"] = ua(device)
    get :pref_list, pref_id: 1
    end
    context 'PCͰindexʹ઀ଓ' do
    let (:device) { :pc }
    it { expect(response).to be_success }
    end
    context 'εϚϗͰindexʹ઀ଓ' do
    let (:device) { :ios }
    it { expect(response).to be_success }
    end
    end
    describe("GET :pref_list", &test_success(:detail, {pref_id: '1'}))

    View full-size slide

  3. ͜ΕͰςετ͕ॻ͚Δʂ

    View full-size slide

  4. ςετ͕௕͗͢Δʂʂ
    େମɺ"1*͸෼ɺJ04͸෼ɺ"OESPJE͸෼ఔ౓ʜ

    View full-size slide

  5. ΑΖ͍͠ɺͳΒ͹ߴ଎Խͩ

    View full-size slide

  6. test-queue
    ςετͷ࣮ߦΛฒྻԽ
    TEST_QUEUE_WORKERS=10 bundle exec rspec-queue spec/controllers/
    [ 1] 85 examples, 0 failures, 23 pending 12 suites in 14.4211s (pid 27544 exit 0)
    [ 5] 41 examples, 0 failures, 27 pending 7 suites in 16.3810s (pid 27548 exit 0)
    [ 6] 8 examples, 0 failures 2 suites in 32.6764s (pid 27549 exit 0)
    [ 8] 13 examples, 0 failures 1 suites in 34.9417s (pid 27551 exit 0)
    [ 2] 22 examples, 0 failures, 13 pending 5 suites in 35.0436s (pid 27545 exit 0)
    [ 3] 53 examples, 0 failures, 21 pending 1 suites in 43.7377s (pid 27546 exit 0)
    [10] 35 examples, 0 failures, 8 pending 8 suites in 44.4121s (pid 27553 exit 0)
    [ 4] 19 examples, 0 failures, 3 pending 1 suites in 47.4060s (pid 27547 exit 0)
    [ 7] 86 examples, 0 failures, 10 pending 1 suites in 48.8715s (pid 27550 exit 0)
    [ 9] 46 examples, 0 failures, 19 pending 8 suites in 49.0594s (pid 27552 exit 0)
    https://github.com/tmm1/test-queue

    View full-size slide

  7. test-queueͷϝϦοτ
    • ಋೖ͕؆୯ʢDBΛ༻ҙ͢Δඞཁ͕ͳ͍ʣ
    • ׂΓৼΔϓϩηεΛಈతʹܾΊͯ͘ΕΔ
    parallel_testsͱ͔rrrspecͱ͔΋͋Δ͚ͲඍົΒ͍͠
    http://blog.nanapi.co.jp/tech/2015/04/14/wercker_on_test-queue/
    http://gongo.hatenablog.com/entry/2014/08/26/221311

    View full-size slide

  8. test-queueͷಋೖ
    group :development, :test do
    gem 'rspec-rails', '3.1.0'
    gem 'capybara', '2.4.1'
    gem 'selenium-webdriver' #feature test༻
    gem 'headless', '1.0.2' #feature test༻
    gem 'spring', '1.1.3'
    gem 'factory_girl_rails', '4.4.1'
    gem 'minitest', '5.4.0'
    gem 'spork', '0.9.2'
    gem 'guard', '2.6.1'
    gem 'guard-rspec', '4.3.1'
    gem 'guard-spork', '1.5.1'
    gem 'ci_reporter', '~> 1.6.5'
    gem 'test-queue', '0.2.13'
    #debugging gems
    gem 'pry', '0.10.1'
    gem 'pry-rails', '0.3.2'
    gem 'pry-byebug', '2.0.0'
    end
    ←଍͚ͨͩ͠
    Gemfile

    View full-size slide

  9. Happy Hacking!!

    View full-size slide