All Projects → leanphp → behat-code-coverage

leanphp / behat-code-coverage

Licence: BSD-2-Clause license
Generate Code Coverage reports for Behat tests

Programming Languages

PHP
23972 projects - #3 most used programming language
Gherkin
971 projects

Projects that are alternatives of or similar to behat-code-coverage

Phpspec Code Coverage
Generate Code Coverage reports for PhpSpec tests
Stars: ✭ 59 (+22.92%)
Mutual labels:  coverage-report, xdebug, testing-tools, code-coverage
TqExtension
Test your Drupal 7 (D8 in progress) sites easier with TqExtension for Behat.
Stars: ✭ 13 (-72.92%)
Mutual labels:  behat, behat-extension
BehatRestExtension
A RestExtension for Behat
Stars: ✭ 33 (-31.25%)
Mutual labels:  behat, behat-extension
Tester
Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏
Stars: ✭ 281 (+485.42%)
Mutual labels:  xdebug, code-coverage
frankencover.it
Code coverage for iOS and OSX.
Stars: ✭ 102 (+112.5%)
Mutual labels:  coverage-report, code-coverage
Bashcov
Code coverage tool for Bash
Stars: ✭ 113 (+135.42%)
Mutual labels:  coverage-report, code-coverage
mutant-swarm
Mutation testing framework and code coverage for Hive SQL
Stars: ✭ 20 (-58.33%)
Mutual labels:  coverage-report, code-coverage
octocov
octocov is a toolkit for collecting code metrics (code coverage, code to test ratio and test execution time).
Stars: ✭ 191 (+297.92%)
Mutual labels:  coverage-report, code-coverage
playwright-test
Run unit tests with several runners or benchmark inside real browsers with playwright.
Stars: ✭ 81 (+68.75%)
Mutual labels:  testing-tools, code-coverage
software-testing-resource-pack
Various files useful for manual testing and test automation etc.
Stars: ✭ 38 (-20.83%)
Mutual labels:  testing-tools
php-test-generator
Generate test cases for existing PHP files
Stars: ✭ 47 (-2.08%)
Mutual labels:  testing-tools
sushi
The SUSHI test case generator
Stars: ✭ 19 (-60.42%)
Mutual labels:  testing-tools
symfony-lts-docker-starter
🐳 Dockerized your Symfony project using a complete stack (Makefile, Docker-Compose, CI, bunch of quality insurance tools, tests ...) with a base according to up-to-date components and best practices.
Stars: ✭ 39 (-18.75%)
Mutual labels:  testing-tools
TimeBomb
Stops app usage after a period of time has passed starting from app build date.
Stars: ✭ 22 (-54.17%)
Mutual labels:  testing-tools
rtf
Regression testing framework
Stars: ✭ 35 (-27.08%)
Mutual labels:  testing-tools
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-66.67%)
Mutual labels:  testing-tools
tarpaulin
📈 GitHub Action for code coverage reporting with tarpaulin
Stars: ✭ 69 (+43.75%)
Mutual labels:  code-coverage
IO-TESTER
A functional test framework
Stars: ✭ 32 (-33.33%)
Mutual labels:  testing-tools
docker-yii2-app-advanced
dockerized yiisoft/yii2-app-advanced
Stars: ✭ 18 (-62.5%)
Mutual labels:  xdebug
rfswarm
Robot Framework Swarm
Stars: ✭ 68 (+41.67%)
Mutual labels:  testing-tools

behat-code-coverage

License Latest Stable Version Total Downloads Travis AppVeyor Pre Release

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.

Requirements

Change Log

Please see CHANGELOG.md for information on recent changes.

Install

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-coverage

This 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.

Usage

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

Running with phpdbg

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

Configuration

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/html

Configuration Options

  • auth - HTTP authentication options (optional).
  • create (method / path) - override options for create method:
    • method - specify a method (default: POST)
    • path - specify path (default: /)
  • read (method / path) - override options (method and path) for read method.
    • method - specify a method (default: GET)
    • path - specify path (default: /)
  • delete (method / path) - override options (method and path) for delete method.
    • method - specify a method (default: DELETE)
    • path - specify path (default: /)
  • drivers - a list of drivers for gathering code coverage data:
    • local - local Xdebug driver (default).
    • remote - remote Xdebug driver (disabled by default).
  • filter - various filter options:
    • forceCoversAnnotation - (default: false)
    • mapTestClassNameToCoveredClassName - (default: false)
    • whiltelist - whitelist specific options:
      • addUncoveredFilesFromWhiltelist - (default: true)
      • processUncoveredFilesFromWhitelist - (default: false)
      • include - a list of files or directories to include in whitelist:
        • directories - key containing whitelisted directories to include.
          • suffix - suffix for files to be included (default: '.php')
          • prefix - prefix of files to be included (default: '') (optional)
        • files - a list containing whitelisted files to include.
      • exclude - a list of files or directories to exclude from whitelist:
        • directories - key containing whitelisted directories to exclude.
          • suffix - suffix for files to be included (default: '.php')
          • prefix - prefix of files to be included (default: '') (optional)
        • files - key containing whitelisted files to exclude.
  • report - reporter options:
    • format - specify report format (html, clover, php, text)
    • options - format options:
      • target - target/output directory

Authors

Copyright (c) 2017 ek9 [email protected] (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.

License

Licensed under BSD-2-Clause License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].