matthiasnoback / gherkin-features-html-exporter
用于将Gherkin特性导出为HTML的工具
v0.1.0
2021-04-24 19:15 UTC
Requires
- php: >=7.4
- behat/gherkin: ^4.8
- league/commonmark: ^1.5
- symfony/console: ^4.4|^5.2
- thecodingmachine/safe: ^1.3
- wa72/html-pretty-min: ^0.2.0
Requires (Dev)
- behat/behat: ^3.8
- phpstan/phpstan: ^0.12.83
- phpunit/phpunit: ^9.5
README
此库使用 behat/gherkin(Behat也使用它)来解析 .feature 文件,并渲染您自己可以样式的HTML页面,导出为PDF,并展示给其他利益相关者。
入门
使用Composer安装
composer require --dev matthiasnoback/gherkin-features-html-exporter
用法
vendor/bin/export-gherkin [features/] [export/] --stylesheet style.css
样式表是 可选的,应存在于提供的 [export/] 目录中。
对于 [features/] 中的每个 .feature 文件,将在 [export/] 中生成相应的 .html 文件。
按标签组合特性
使用此工具的另一种方法是,将具有给定标签的所有特性组合到一个名为该标签的单个 .html 文件中。
vendor/bin/export-gherkin [features/] [export/] --stylesheet style.css --tag wip
这将找到所有带有 @wip 标签的特性,并将它们存储在名为 [export/]wip.html 的文件中。
重新格式化HTML
在保存之前有一个选项可以重新格式化HTML。
vendor/bin/export-gherkin [features/] [export/] --reformat
演示
您将在 demo 文件夹中找到一个 example.feature 文件,以及其生成的 example.html 文件。您可以使用 style.css 作为示例样式表。 example.html 是通过运行以下命令生成的:
bin/export-gherkin demo demo --stylesheet style.css --reformat