我尝试在我的 behat.yml 中并将模板放在我的 /support 目录中,但没有帮助。
default:
formatter:
name: html
parameters:
template_path: html.tpl
有任何想法吗?
我尝试在我的 behat.yml 中并将模板放在我的 /support 目录中,但没有帮助。
default:
formatter:
name: html
parameters:
template_path: html.tpl
有任何想法吗?
您可以从现有扩展自定义类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
请注意,您需要\\
正确发送类名。