All Projects → leanphp → Phpspec Code Coverage

leanphp / Phpspec Code Coverage

Licence: other
Generate Code Coverage reports for PhpSpec tests

Projects that are alternatives of or similar to Phpspec Code Coverage

behat-code-coverage
Generate Code Coverage reports for Behat tests
Stars: ✭ 48 (-18.64%)
Mutual labels:  coverage-report, xdebug, testing-tools, code-coverage
bat
Gherkin based DSL for testing HTTP APIs via Cucumber.JS
Stars: ✭ 30 (-49.15%)
Mutual labels:  bdd, testing-tools
MockDataGenerator
Generate mock data for POCO
Stars: ✭ 12 (-79.66%)
Mutual labels:  unittest, testing-tools
Tester
Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏
Stars: ✭ 281 (+376.27%)
Mutual labels:  xdebug, code-coverage
orion
A next-generation testing tool. Orion provides a powerful DSL to write and automate your acceptance tests
Stars: ✭ 40 (-32.2%)
Mutual labels:  bdd, testing-tools
JUnitPerf
API performance testing framework built using JUnit
Stars: ✭ 48 (-18.64%)
Mutual labels:  unittest, testing-tools
frankencover.it
Code coverage for iOS and OSX.
Stars: ✭ 102 (+72.88%)
Mutual labels:  coverage-report, code-coverage
kheera-testrunner-android
BDD Framework for Android
Stars: ✭ 18 (-69.49%)
Mutual labels:  bdd, testing-tools
Spry
A Mac and iOS Playgrounds Unit Testing library based on Nimble.
Stars: ✭ 319 (+440.68%)
Mutual labels:  bdd, unittest
Serenity Js
A next generation, full-stack acceptance testing framework optimised for collaboration, speed and scale!
Stars: ✭ 346 (+486.44%)
Mutual labels:  testing-tools, bdd
Testfx
MSTest V2 framework and adapter
Stars: ✭ 391 (+562.71%)
Mutual labels:  testing-tools, unittest
mutant-swarm
Mutation testing framework and code coverage for Hive SQL
Stars: ✭ 20 (-66.1%)
Mutual labels:  coverage-report, code-coverage
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-66.1%)
Mutual labels:  unittest, testing-tools
showroom
Universal development and automated test environment for web components
Stars: ✭ 89 (+50.85%)
Mutual labels:  bdd, testing-tools
karate-runner
VSCode Extension for Karate
Stars: ✭ 23 (-61.02%)
Mutual labels:  bdd, testing-tools
behave-restful
BDD Framework to Test REST Services and APIs
Stars: ✭ 47 (-20.34%)
Mutual labels:  bdd, testing-tools
unitest
🌎 Seamless node and browser unit testing with code coverage
Stars: ✭ 28 (-52.54%)
Mutual labels:  coverage-report, unittest
Karate
Test Automation Made Simple
Stars: ✭ 5,497 (+9216.95%)
Mutual labels:  testing-tools, bdd
Pho
BDD test framework for PHP
Stars: ✭ 287 (+386.44%)
Mutual labels:  testing-tools, bdd
Mocha
☕️ simple, flexible, fun javascript test framework for node.js & the browser
Stars: ✭ 20,986 (+35469.49%)
Mutual labels:  testing-tools, bdd

phpspec-code-coverage

License Latest Stable Version Total Downloads Scrutinizer Code Quality Travis AppVeyor

phpspec-code-coverage is a PhpSpec extension that generates Code Coverage reports for PhpSpec 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 henrikbjorn/phpspec-code-coverage package with compatible version numbers for stable releases.

phpspec-code-coverage console report phpspec-code-coverage HTML report

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/phpspec-code-coverage

Enable extension by editing phpspec.yml of your project:

extensions:
  LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: ~

This will sufficient to enable Code Coverage generation by using defaults provided by the extension. This extension supports various configuration options. For a fully annotated example configuration file check Configuration section.

Usage

If you execute phpspec run command, you will see code coverage generated in coverage directory (in html format):

$ bin/phpspec run

Note! When generating Code Coverage reports make sure PHP processes run via CLI are not memory limited (i.e. memory_limit set to -1 in /etc/php/cli/php.ini).

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 phpspec run

Note! PHP 7+ is required for code generation to work with phpdbg.

Configuration

You can see fully annotated phpspec.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.

# phpspec.yml
# ...
extensions:
  # ... other extensions ...
  # leanphp/phpspec-code-coverage
  LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension:
    # Specify a list of formats in which code coverage report should be
    # generated.
    # Default: [html]
    format:
      - text
      - html
      #- clover
      #- php
      #- xml
    #
    # Specify output file/directory where code coverage report will be
    # generated. You can configure different output file/directory per
    # enabled format.
    # Default: coverage
    output:
      html: coverage
      #clover: coverage.xml
      #php: coverage.php
      #xml: coverage
    #
    # Should uncovered files be included in the reports?
    # Default: true
    #show_uncovered_files: true
    #
    # Set lower upper bound for code coverage
    # Default: 35
    #lower_upper_bound: 35
    #
    # Set high lower bound for code coverage
    # Default: 70
    #high_lower_bound: 70
    #
    # Whilelist directories for which code generation should be done
    # Default: [src, lib]
    #
    whitelist:
      - src
      - lib
    #
    # Whiltelist files for which code generation should be done
    # Default: empty
    #whilelist_files:
      #- app/bootstrap.php
      #- web/index.php
    #
    # Blacklist directories for which code generation should NOT be done
    #blacklist:
      #- src/legacy
    #
    # Blacklist files for which code generation should NOT be done
    #blacklist_files:
      #- lib/bootstrap.php

Options

  • format (optional) a list of formats in which code coverage should be generated. Can be one or many of: clover, php, text, html, xml (default html) Note: When using clover format option, you have to configure specific output file for the clover format (see below).
  • output (optional) sets an output file/directory where specific code coverage format will be generated. If you configure multiple formats, takes a hash of format:output (e.g. clover:coverage.xml) (default coverage)
  • show_uncovered_files (optional) for including uncovered files in coverage reports (default true)
  • lower_upper_bound (optional) sets lower upper bound for code coverage (default 35).
  • high_lower_bound (optional) sets high lower bound for code coverage (default 70)
  • whitelist takes an array of directories to whitelist (default: lib, src).
  • whitelist_files takes an array of files to whitelist (default: none).
  • blacklist takes an array of directories to blacklist (default: test, vendor, spec)
  • blacklist_files takes an array of files to blacklist

Authors

Copyright (c) 2017-2018 ek9 [email protected] (https://ek9.co).

Copyright (c) 2013-2016 Henrik Bjornskov, for portions of code from henrikbjorn/phpspec-code-coverage project.

License

Licensed under MIT 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].