vstelmakh/covelyzer
Composer 安装命令:
composer require vstelmakh/covelyzer
包简介
Tool to analyze PHPUnit test coverage report in clover format
README 文档
README
Covelyzer - PHP console tool to analyze PHPUnit test coverage report in clover (XML) format. Covelyzer integrates coverage metrics directly into the workflow forcing developers to write tests and forbidding delivery of uncovered code.
Highlights:
- Works in console
- Easy to integrate
- Flexible configuration
- Same setup locally and on CI
- Not depend on third-party service
Installation
Install the latest version with Composer:
composer require --dev vstelmakh/covelyzer
Usage
Before you start, run tests with options to generate coverage report in XML format. See corresponding PHPUnit documentation reference Code coverage analysis and Covelyzer phpunit.xml, composer.json scripts section as an example.
Run tests with XML coverage xdebug example:
vendor/bin/phpunit --dump-xdebug-filter var/xdebug-filter.php && \
vendor/bin/phpunit --prepend var/xdebug-filter.php --coverage-clover var/coverage.xml --whitelist src
Run Covelyzer with default configuration:
vendor/bin/covelyzer var/coverage.xml
To specify additional configuration see Configuration.
Configuration
Configuration defined in covelyzer.xml located under project root (where vendor dir located). Or
configuration path could be overridden via -c | --config command option:
vendor/bin/covelyzer var/coverage.xml -c path/to/covelyzer.xml
If no configuration file provided - default configuration is used.
Example configuration:
<?xml version="1.0" encoding="UTF-8" ?> <covelyzer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/vstelmakh/covelyzer/resources/config.xsd" timezone="Europe/Berlin" > <project minCoverage="100"/> <class minCoverage="100"/> </covelyzer>
<covelyzer> element
Config root element.
timezone attribute
Timezone should be used to display timestamp.
- use:
optional - type:
string(see: php timezones) - command option: could be defined/overridden via
--timezonecommand option
<project> element
Defines configuration for project coverage report. If defined project coverage report will be rendered.
- parent:
<covelyzer> - use:
optional
minCoverage attribute
Minimum coverage value. If project have less coverage - report will fail.
- use:
required - type:
float(min: 0, max: 100)
<class> element
Defines configuration for class coverage report. If defined class coverage report will be rendered.
- parent:
<covelyzer> - use:
optional
minCoverage attribute
Minimum coverage value. If any class have less coverage - report will fail.
- use:
required - type:
float(min: 0, max: 100)
Tips & tricks
Use help option
Use -h | --help command option to display Covelyzer help data. It contains all available arguments, options and usage examples.
vendor/bin/covelyzer --help
Ignore code blocks
Covelyzer will analyze full report produced by PHPUnit. In some cases you want to ignore some code parts to not be taken into account. There are several options available, see Ignoring code blocks in PHPUnit documentation.
Speed up coverage with Xdebug
The performance of code coverage data collection with Xdebug can be improved by delegating whitelist filtering to Xdebug. See corresponding PHPUnit docs section: Speeding up code coverage with Xdebug.
Credits
Volodymyr Stelmakh
Licensed under the MIT License. See LICENSE for more information.
vstelmakh/covelyzer 适用场景与选型建议
vstelmakh/covelyzer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.08k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「phpunit」 「test」 「console」 「report」 「analyzer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vstelmakh/covelyzer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vstelmakh/covelyzer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vstelmakh/covelyzer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HiDev plugin for PHPUnit
Testing Suite For Lumen like Laravel does.
A cli tool which generates unit tests.
Specification-oriented BDD helpers for PHPUnit
PHPUnit DbUnit Native Array-based Fixtures
KissTest is command-line free, fast, simple and beautiful unit test framework.
统计信息
- 总下载量: 5.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 20
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-09