sweetchuck / behat-tap-formatter
A TAP formatter for Behat
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 2
pkg:composer/sweetchuck/behat-tap-formatter
Requires
- php: >=8.3
- behat/behat: ^3.3
- symfony/console: ^7.3
- symfony/yaml: ^7.0
Requires (Dev)
- ext-dom: *
- ext-json: *
- nuvoleweb/robo-config: ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^11.0
- squizlabs/php_codesniffer: ^4.0
- sweetchuck/git-hooks: 2.x-dev
- sweetchuck/robo-git: 4.x-dev
- sweetchuck/robo-phpcs: 4.x-dev
- sweetchuck/robo-phpstan: 3.x-dev
- symfony/error-handler: ^7.0
- symfony/filesystem: ^7.3
This package is auto-updated.
Last update: 2025-11-17 20:57:13 UTC
README
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