thienthu1410 / behat-html-formatter
此包的最新版本(dev-master)没有提供许可证信息。
这将创建一个用于 Behat 的 HTML 格式化工具。
dev-master
2019-02-27 02:14 UTC
Requires
- php: >=5.3.0
- behat/behat: ~3.0
- twig/twig: ~1.0
This package is auto-updated.
Last update: 2024-09-27 14:34:23 UTC
README
欢迎提出建议!
这是一个 Behat 3 扩展,用于从测试结果生成 HTML 报告。
将其添加到您的 behat.yml 文件中
formatters: html: output_path: %paths.base%/build/html/behat extensions: thienthu1410\BehatHTMLFormatter\BehatHTMLFormatterExtension: name: html renderer: Twig not_count_tag: suite-setup,suite-teardown file_name: Index print_args: true
output 参数相对于 %paths.base%,如果省略,则默认为该路径。
renderer 是渲染引擎和您希望生成的报告格式。
file_name 是可选的。如果添加,报告名称将是固定的,而不是生成的,并且该文件将在每次构建时被覆盖。
not_count_tag 是可选的。如果添加,则带有在 not_count_tag 中定义的标记的场景将不会被计数,但仍然会打印详细信息。适用于 suite-setup 或 suite-teardown 的情况
实际上,有 1 种格式
- Twig : 基于 Twig 的新报告格式,需要安装 Twig
您必须在 renderer 参数中指定要使用的格式。
文件名格式为: "renderer name"_"date hour"
Twig 渲染器只参数
print_args 是可选的。如果添加,则报告中将包含每个步骤的参数(如果存在)。(例如,表格)
print_outp 是可选的。如果添加,则报告中将包含每个步骤的输出(如果存在)。(例如,异常)
待办事项
- 为 behat.yml 文件添加参数
- 将 Bootstrap 添加为依赖项
- 清理 HTML 报告
- 添加 out 参数
屏幕截图
查看报告时的分析
- 概览图
- 功能图:功能总数,通过的功能数量,失败的功能数量
- 测试用例图:测试用例总数,通过的数量,失败的数量。每个测试用例都与套件中的场景描述相映射。
- 场景图:场景总数,通过的数量,失败的数量。每个场景都与场景概述中的单个场景或示例相映射。
- 关于测试用例和场景的示例
- 示例 1:1 个测试用例,1 个场景
Scenario: test 1 Given I am on "aaa" Then the url should match "aaa"
- 示例 2:1 个测试用例,2 个场景
Scenario Outline: test 1 Given I am on "<pagel>" Then the url should match "<url>" Examples: | page | url | | aaa | aaa | | aaa | bbb |
- 示例 3:2 个测试用例,2 个场景
Scenario: test 1 Given I am on "aaa" Then the url should match "aaa" Scenario: test 2 Given I am on "bbb" Then the url should match "bbb"
- 示例 4:2 个测试用例,3 个场景
Scenario: test 1 Given I am on "aaa" Then the url should match "aaa" Scenario Outline: test 2 Given I am on "<page>" Then the url should match "<url>" Examples: | page | url | | aaa | aaa | | aaa | bbb |
- 套件概览
- 包含套件中运行的所有功能。
- 每个功能顶部有关于功能描述的信息
- 每个功能底部有关于该功能测试用例通过/失败的信息。失败的测试用例数量在红色区域,通过的测试用例数量在绿色区域。还有关于功能标记的信息