0
0

More than 1 year has passed since last update.

【Rsepc】実行時間が長いテストを抽出する

Posted at

profileオプション

テストケースごとの実行時間がわかり、時間がかかっているテストを抽出することができる。

$ bundle exec rspec --profileで実行時間がかかっているテストケースとその実行時間の上位10個が出力される。
デフォルトで10件表示されるようになっているので、
$ bundle exec rspec --profile 20と指定して上げると、上位20個が表示される

ディレクトリごとに分けて実行するのが良い

すべてのテストコードを実行するのだと、大きなアプリケーションだと時間かかるので、ディレクトリごとに確認した方が良い。

ex)
bundle exec rspec --profile 20 spec/controllers/
bundle exec rspec --profile 20 spec/models/

# 1つのテストケースの時間も確認できる
ex)
bundle exec rspec --profile 10 spec/models/user/user_spec.rb:40
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0