LoginSignup
3
3

More than 5 years have passed since last update.

[test][cucumber] cucumberで失敗したシナリオだけ再実行する

Posted at

はじめに

rerunの使い方についての情報が思ったより引っかからなかったので書きます

環境

  • Ubuntu 16.04.2 LTS
  • ruby 2.4.1p111 (2017-03-22 revision 58053)
  • cucumber (2.4.0)

失敗したシナリオの一覧を作成する

cucumber実行時に以下のオプションで失敗したシナリオのファイルパスと行番号が記述されたファイルが作成されます

cucumber -f rerun -o rerun.txt

標準出力、HTMLレポート作成も同時に行うには以下のドキュメントが参考になります

cucumber で 同時に別々のフォーマットで出力する方法
https://qiita.com/bamchoh/items/1828d3b0d38a4f398984

rerun.txtの中身は以下のようにfeatureのファイルパスと失敗したシナリオの行番号が記載されています

rerun.txt
features/login.feature:33:44:55
features/logout.feature:66:77

失敗したシナリオ一覧を再実行する

cucumber @rerun.txt

rerun.txtに記載されたシナリオのみ実行されます

3
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
3
3