2016-12-30 11 views
0

명백한 문제는 천천히 실행되는 테스트가 필요하지 않습니다. 그러나 RSpec은 기본적으로 개별 테스트의 속도에 대한 정보를 제공하지 않으며 요약 정보 만 제공합니다.RSpec 테스트 속도 측정

어떻게 이것을 변경하고 느린 실행 테스트 스위트를 담당하는 테스트를 찾을 수 있도록 정보를 얻을 수 있습니까?

답변

3

rspec --profile을 사용하십시오. 출력

예 :

Top 10 slowest examples (911.59 seconds, 100.0% of total time): 
    WordProcessor should normalize, synonimize and variantify 
    874.29 seconds ./spec/word_processor_spec.rb:20 
    Normalizer should return singular nominative masculine case (mianownik liczby pojedynczej, forma męska dla przymiotników) of phrases where every word may be normalized to singular nominative case (mianownik liczby pojedynczej) 
    37.12 seconds ./spec/word_normalize_spec.rb:35 
    VariantFinder should return singular nominative case (mianownik liczby pojedynczej) of complex phrases 
    0.06575 seconds ./spec/word_find_all_variants_spec.rb:49 
    Normalizer should return singular nominative masculine case (mianownik liczby pojedynczej, forma męska dla przymiotników) of phrases where transforming every word separately is not solution 
    0.03283 seconds ./spec/word_normalize_spec.rb:44 
    WordProcessor synonimize all produced variants 
    0.02776 seconds ./spec/word_processor_spec.rb:49 
    Synonym returns array of known synonyms 
    0.02643 seconds ./spec/word_synonym_spec.rb:26 
    VariantFinder should return all forms including singular nominative masculine case (mianownik liczby pojedynczej, forma męska dla przymiotników) 
    0.00995 seconds ./spec/word_find_all_variants_spec.rb:10 
    Synonym should allow more specified terms to be synonyms of general, but general not to be synonym of specific 
    0.00924 seconds ./spec/word_synonym_spec.rb:48 
    Normalizer should return singular nominative masculine case (mianownik liczby pojedynczej, forma męska dla przymiotników) 
    0.00814 seconds ./spec/word_normalize_spec.rb:10 
    VariantFinder should return all valid variants 
    0.00319 seconds ./spec/word_find_all_variants_spec.rb:32 

Top 5 slowest example groups: 
    WordProcessor 
    291.44 seconds average (874.31 seconds/3 examples) ./spec/word_processor_spec.rb:4 
    Normalizer 
    7.43 seconds average (37.17 seconds/5 examples) ./spec/word_normalize_spec.rb:4 
    VariantFinder 
    0.01222 seconds average (0.08556 seconds/7 examples) ./spec/word_find_all_variants_spec.rb:4 
    Synonym 
    0.01005 seconds average (0.04018 seconds/4 examples) ./spec/word_synonym_spec.rb:4 
    RecipeSplitter 
    0.0008 seconds average (0.00319 seconds/4 examples) ./spec/recipe_splitter_spec.rb:6 

Finished in 15 minutes 12 seconds (files took 0.30729 seconds to load) 
23 examples, 0 failures, 2 pending 

용액 http://shuheikagawa.com/blog/2015/09/26/speed-up-your-rspec-tests-by-reviewing-factory-girl/

에서 발견