4
3

More than 5 years have passed since last update.

Rail3 + kaminari の画面を selenium webdriver を使ってテストする例の試作

Last updated at Posted at 2014-07-20

課題

  • kaminari でつくったページネーション機能を 実際のブラウザをつかって自動テストする。
  • デグレードを早期発見できるようにする。

デザインゴール

  • selenium webdreiver を使って firefox を自動操縦する。
  • 各テストで スクリーンショット、html ソースを保存してエビデンスとする。
  • 以前のテスト実施時のスクリーンショットと 最新のテスト実施時のスクリーンショットの差分を抽出する。
  • html ソースの html5 妥当性チェックもおこなえるようにする。

成果 (実装例)

https://github.com/katoy/rails3-files/ にアップした。
スクリーンショットの例 ./selenium-screenshots-prev/0015-sample001_16.png

$ bundle install
$ bundle exec rake db:migrate

別端末で rails アプリを起動する。

$ bundle exec rails s

元の端末で テストを実行する。

$ bundle exec rake spec          # テストの実施 ( firefox が自動起動する)
$ bundle exec rake tidy          # html チェックの実施
$ bundle exec rake diff-images   # スクリーンショットの差分チェックの実施

残件

  • travis-ci でテスト実施できるようにする。
  • jenkins でテスト実施できるようにする。
  • コードカバレッジ計測をする。

備考

rake rubocop   # rubocop で ruby ソースコードのチェックを行う。
rake stats     # ソースの行数カウントを行う。
rake erd       # DB の ERM 図を  ./erb.pdf として出力する。 
rake metrics   # metricfu を実行する。
yard           # ドキュメント (./doc/index.html) を生成する。
4
3
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
4
3