1

ステップのないシナリオ タイトルのみで cucumber html レポートを生成することは可能ですか?

電子メールで HTML レポートを生成しようとしていますが、レポートが巨大ではなく、どのシナリオが失敗したかを簡単に知ることができるように、タイトルのみのすべてのシナリオでレポートを生成したいと考えています。

誰かがこれに対する解決策を持っていると確信しています。これを共有するか、どうすれば解決できるか教えてください。

前もって感謝します

4

1 に答える 1

2

カスタムフォーマッタを構築する必要があります。Cucumber Wikiには、これに関する詳細が記載されています。

手順を非表示にするために、Html フォーマッタbefore_step_resultbuild_stepメソッドをオーバーライドするカスタム フォーマッタを作成できます。

サポート フォルダーの場合、以下を使用して .rb ファイルを作成します。

require 'cucumber/formatter/html'

module Cucumber
  module Formatter
    class HtmlStepless < Html
      def before_step_result(step_result)
        #TODO: What is this used for?
        @step_match = step_result.step_match
        @hide_this_step = true
        if step_result.exception
          if @exceptions.include?(step_result.exception)
            @hide_this_step = true
            return
          end
          @exceptions << step_result.exception
        end
        if step_result.status != :failed && @in_background ^ step_result.background
          @hide_this_step = true
          return
        end
        @status = step_result.status
        return if @hide_this_step
        set_scenario_color(step_result.status)
        @builder << "<li id='#{@step_id}' class='step #{step_result.status}'>"
      end

      def build_step(keyword, step_match, status)
        # Do nothing
      end

    end
  end
end

Cucumber を実行するときに、カスタム フォーマッタを使用するように指示します。

cucumber -f Cucumber::Formatter::HtmlStepless -o output.htm
于 2013-08-16T13:02:49.953 に答える