2013-02-22 62 views
5

我爲我的rails應用程序提供了一個黃瓜測試套件,其中包含大約500個場景,它們之間有大約5000個步驟。黃瓜測試套件對於特拉維斯來說太慢

我已經建立了我的github存儲庫,使用Travis-CI,使用以下.travis.yml

language: ruby 
rvm: 
    - "1.9.2" 
script: 
    - RAILS_ENV=test bundle exec rake db:migrate --trace 
    - bundle exec cucumber -f progress -r features features/cards/base_game 
    - bundle exec cucumber -f progress -r features features/cards/basic_cards 
    - bundle exec cucumber -f progress -r features features/cards/intrigue 
    - bundle exec cucumber -f progress -r features features/cards/seaside 
    - bundle exec cucumber -f progress -r features features/cards/prosperity 
    - bundle exec cucumber -f progress -r features features/cards/interactions 
before_script: 
    - cp config/database.travis.yml config/database.yml 
    - psql -c 'create database dominion_test' -U postgres 

我已經分手了黃瓜執行起來作爲特拉維斯被扔內存,如果我只是跑bundle exec cucumber運行所有案件。

但是,我最近的推動產生了一個特拉維斯任務,花了超過50分鐘來運行我所有的測試,因此被殺害。我只是在這麼多場景中不合理,或者我能做些什麼來加速執行?

編輯:萬一它很重要,我應該澄清我的方案不測試GUI。他們正在測試紙牌遊戲服務器的規則,所以他們直接調用模型方法。

回答

5

我在this page of Travis' docs之後發現了一個解決方案,經過大量的搜索。

基本上,它允許(推薦,甚至!)來平行運行。通過以下.travis.yml,我結束了六個同時工作,其中沒有一個需要15分鐘,因此所有工作都完成:

language: ruby 
rvm: 
    - "1.9.2" 
env: 
    - CARD_SET=base_game 
    - CARD_SET=basic_cards 
    - CARD_SET=intrigue 
    - CARD_SET=seaside 
    - CARD_SET=prosperity 
    - CARD_SET=interactions 
script: 
    - RAILS_ENV=test bundle exec rake db:migrate --trace 
    - bundle exec cucumber -f progress -r features features/cards/$CARD_SET 
before_script: 
    - cp config/database.travis.yml config/database.yml 
    - psql -c 'create database dominion_test' -U postgres