3

behat.yml を試して、テンプレートを /support ディレクトリ内に配置しましたが、助けにはなりませんでした。

    default:
      formatter:
        name:  html
        parameters:
          template_path: html.tpl

何か案は?

4

1 に答える 1

3

既存のクラスからカスタム クラスを拡張してHtmlFormatter、HTML テンプレートを明示的に設定できます。

PHP

namespace Behat\Behat\Formatter;
use Behat\Behat\Formatter\HtmlFormatter;

class MyHtmlFormatter extends HtmlFormatter {

    /**
     * The HTML template to use for formatting.
     * @return string
     */
    protected function getHtmlTemplate()
    {
        return '
          <div id="behat">
            {{content}}
          </div>
        ';
    }

    // You can override any other methods of HtmlFormatter that you want
    // to define custom behavior.
}

behat.yml次に、カスタム クラスを指すようにファイルを更新します。

behat.yml--format (オプション - behat コマンド ラインで使用しない場合にのみ必要です。)

default:
    formatter:
        name: Behat\Behat\Formatter\MyHtmlFormatter

ベハット

最後にbehat、次のコマンドで実行します。

behat --out out.html your_feature.feature

このフォーマッタを直接指定する場合は、次のようにします。

behat --format Behat\\Behat\\Formatter\\MyHtmlFormatter --out o.html

\\クラス名を正しく送信するには が必要であることに注意してください。

于 2012-11-12T17:41:13.200 に答える