matthiasnoback/behat-remote-code-coverage-extension
Composer 安装命令:
composer require matthiasnoback/behat-remote-code-coverage-extension
包简介
README 文档
README
This extension can be used to collect code coverage data from the web server that's called by Mink while running Behat.
To use this extension, enable it under extensions and for every suite that needs remote code coverage collection, set remote_coverage_enabled to true.
default: extensions: BehatRemoteCodeCoverage\RemoteCodeCoverageExtension: target_directory: '%paths.base%/var/coverage' suites: default: remote_coverage_enabled: true
Now modify the front controller of your web application to look like this:
use LiveCodeCoverage\RemoteCodeCoverage; $shutDownCodeCoverage = RemoteCodeCoverage::bootstrap( (bool)getenv('CODE_COVERAGE_ENABLED'), sys_get_temp_dir(), __DIR__ . '/../phpunit.xml.dist' ); // Run your web application now... // This will save and store collected coverage data: $shutDownCodeCoverage();
Make sure to modify the call to RemoteCodeCoverage::bootstrap() if needed:
- Provide your own logic to determine if code coverage should be enabled in the first place (this example uses an environment variable for that). This is important for security reasons. It helps you make sure that the production server won't expose any collected coverage data.
- Provide your own directory for storing the coverage data files (
.cov). - Provide the path to your own
phpunit.xml(.dist)file. This file is only used for its code coverage filter configuration.
After a test run, the extension makes a special call (/?code_coverage_export=true&...) to the web application. The response to this call contains the serialized code coverage data. It will be stored as a file in target_directory, named after the test suite itself, e.g. default.cov.
You can use these .cov files to generate nice reports, using phpcov.
You could even configure PHPUnit to generate a .cov file in the same directory, so you can combine coverage data from PHPUnit and Behat in one report.
To (also) generate (local) code coverage during a Behat test run, use the LocalCodeCoverageExtension.
matthiasnoback/behat-remote-code-coverage-extension 适用场景与选型建议
matthiasnoback/behat-remote-code-coverage-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 350.8k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2018 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matthiasnoback/behat-remote-code-coverage-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matthiasnoback/behat-remote-code-coverage-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 350.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-07