定制 sweetchuck/behat-tap-formatter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sweetchuck/behat-tap-formatter

Composer 安装命令:

composer require sweetchuck/behat-tap-formatter

包简介

A TAP formatter for Behat

关键字:

README 文档

README

QA codecov

What is This?

A TAP (Test Anything Protocol) formatter for Behat that converts Behat test results into standardized TAP format. This formatter outputs test results in a machine-readable format that conforms to the TAP 14 specification, enabling integration with CI/CD systems and tools that consume TAP output.

When to Use

  • CI/CD Integration: Parse Behat test results programmatically in your CI/CD pipeline
  • Machine-Readable Reports: Generate structured test output for automated analysis and reporting
  • Multi-Format Testing: Combine TAP output with other test formatters to serve different needs
  • Test Aggregation: Feed results into TAP harnesses that aggregate and report on multiple test suites
  • Platform Integration: Use with TAP-compatible tools for reporting, parsing, and analysis

Configuration

Command line: behat --config-reference:

Output:

tap:
    # If TRUE then the exception trace is added into the YamlBlock when a test fails.
    show_trace:           true

    # Number of entries from the call stack to show. 0 to show all.
    # Used only when "show_trace" is TRUE.
    trace_depth:          3

    # Show steps as subtests.
    # Allowed values:
    # - never: Do not show the steps as subtest test points.
    # - on_failure: Shows the steps as subtest test points only when there was a failure.
    # - always: Always shows the steps as test points.
    show_executed_steps:  on_failure

    # When there was a failure, show the remaining steps as skipped test points.
    # This only makes sense when "show_executed_steps" is set to "on_failure" or "always".
    show_remaining_steps: false

Quick starter

default:
    extensions:
        Sweetchuck\BehatTapFormatter\TapFormatterExtension: ~
    formatters:
        tap:
            show_trace: true
            trace_depth: 3
            show_executed_steps: 'on_failure'
            show_remaining_steps: false

Run your tests:

behat --format='tap'

Configuration Options

show_trace (boolean, default: true)

Include exception stack traces in the TAP YAML block when tests fail. Useful for debugging.

trace_depth (integer, default: 3)

Number of stack trace entries to display. Set to 0 to show all entries. Only used when show_trace is true.

show_executed_steps (string, default: 'on_failure')

Control how individual steps are reported as subtests.

Allowed values:

  • 'never': Don't show steps as subtest points
  • 'on_failure': Show steps as subtest points only when a scenario fails
  • 'always': Always show steps as subtest test points

show_remaining_steps (boolean, default: false)

When a failure occurs, show remaining steps as skipped test points. Only meaningful with show_executed_steps set to 'on_failure' or 'always'.

Output Examples

Feature: My feature 01

  Scenario: My scenario 01
    Given I have a thing
    When I create a thing
    Then I see two things

  Scenario: My scenario 02
    Given I have a thing
    When something broke
    Then I see two things

Configuration:

show_trace: false
show_executed_steps: 'never'
show_remaining_steps: false

Output:

TAP version 14
ok 1 - default: My feature 01 | My scenario 01
not ok 2 - default: My feature 01 | My scenario 02
1..2

Configuration:

show_trace: false
show_executed_steps: 'on_failure'
show_remaining_steps: false

Output:

TAP version 14
ok 1 - default: My feature 01 | My scenario 01
# Subtest: Steps
    ok 1 - I have a thing
    not ok 2 - When something broke
    1..3
not ok 2 - default: My feature 01 | My scenario 02
  ---
  feature:
    title: 'Scenario step arguments'
    file: my-feature-01.feature
  scenario:
    title: 'My scenario 02'
    line: 8
  step:
    text: 'When something broke'
    line: 10
  message: 'Depends on the exception.'
  ...
1..2

Configuration:

show_trace: false
show_executed_steps: 'on_failure'
show_remaining_steps: true

Output:

TAP version 14
ok 1 - default: My feature 01 | My scenario 01
# Subtest: Steps
    ok 1 - I have a thing
    not ok 2 - When something broke
    not ok 3 - Then I see two things # SKIP previous step failed
    1..3
not ok 2 - default: My feature 01 | My scenario 02
  ---
  feature:
    title: 'Scenario step arguments'
    file: my-feature-01.feature
  scenario:
    title: 'My scenario 02'
    line: 8
  step:
    text: 'When something broke'
    line: 10
  message: 'Depends on the exception.'
  ...
1..2

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2025-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固