| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
behat-code-coverage is a Behat extension that generates Code Coverage reports for Behat tests.
Generating Code Coverage reports allows you to to analyze which parts of your codebase are tested and how well. However, Code Coverage alone should NOT be used as a single metric defining how good your tests are.
Note! This is a maintained fork of vipsoft/code-coverage-extension, including codebase for vipsoft/code-coverage-common package with compatible version numbers for stable releases.
Please see CHANGELOG.md for information on recent changes.
Install this package as a development dependency in your project:
$ composer require --dev leanphp/behat-code-coverage
Enable extension by editing behat.yml of your project:
default:
extensions:
LeanPHP\Behat\CodeCoverage\Extension:
drivers:
- local
filter:
whitelist:
include:
directories:
'src': ~
report:
format: html
options:
target: build/behat-coverageThis will sufficient to enable Code Coverage generation in html format in build/behat-coverage directory. This extension supports various Configuration options. For a fully annotated example configuration file check Configuration section.
If you execute bin/behat command, you will see code coverage generated in target (i.e. build/behat-coverage) directory (in html format):
$ bin/behat
This extension now supports phpdbg, which results in faster execution when using more recent versions of PHP. Run phpspec via phpdbg:
$ phpdbg -qrr bin/behat run
You can see fully annotated behat.yml example file below, which can be used as a starting point to further customize the defaults of the extension. The configuration file below has all of the [Configuration Options](#Configuration Options).
# behat.yml
# ...
default:
extensions:
LeanPHP\Behat\CodeCoverage\Extension:
# http auth (optional)
auth: ~
# select which driver to use when gatherig coverage data
drivers:
- local # local Xdebug driver
# filter options
filter:
forceCoversAnnotation: false
mapTestClassNameToCoveredClassName: false
whitelist:
addUncoveredFilesFromWhitelist: true
processUncoveredFilesFromWhitelist: false
include:
directories:
'src': ~
'tests':
suffix: '.php'
# files:
# - script1.php
# - script2.php
# exclude:
# directories:
# 'vendor': ~
# 'path/to/dir':
# 'suffix': '.php'
# 'prefix': 'Test'
# files:
# - tests/bootstrap.php
# report configuration
report:
# report format (html, clover, php, text)
format: html
# report options
options:
target: build/behat-coverage/htmlCopyright (c) 2017 ek9 dev@ek9.co (https://ek9.co).
Copyright (c) 2013-2016 Anthon Pang, Konstantin Kudryashov everzet and various contributors for portions of code from vipsoft/code-coverage-extension and vipsoft/code-coverage-common projects.
Licensed under BSD-2-Clause License.
| Back | FazBrowse Home | New Git URL |