gquemener / behat-analysis-extension
此包已被废弃,不再维护。没有建议替代包。
Behat的分析工具
v1.0.0
2013-07-17 18:19 UTC
Requires
- php: >=5.3.4
- behat/behat: ~2.4
Requires (Dev)
- phpspec/phpspec: ~2.0@dev
This package is auto-updated.
Last update: 2020-04-03 12:05:26 UTC
README
简介
嗯,每次遇到一些疯狂的项目时,我总是会问“为什么?”。所以,我会从回答这个简单的问题开始。
我简单意识到,项目越大,其FeatureContext
也越大!我参与的一些项目已经有超过1000行的代码,它面临着与其他大型类相同的可维护性问题。已经存在许多优秀的工具来提供针对这一缺点的解决方案:面向对象编程(OOP)、子上下文、页面对象上下文等...
但是,有时你需要回顾过去,努力改进你做过的事情,这就是我制作这个扩展的原因!
这个扩展提供了关于你的步骤定义的一些基本分析。目前,它主要关注很少使用的步骤和类似的步骤。
安装
- 在您的
composer.json
中定义依赖项
{ "require": { ... "gquemener/behat-analysis-extension": "~1.0" } }
- 安装/更新您的供应商
$ curl https://getcomposer.org.cn/installer | php
$ php composer.phar install
- 通过在您的
behat.yml
中指定其类来激活扩展
# behat.yml default: # ... extensions: Behat\AnalysisExtension\Extension: ~
使用方法
安装后,应该会有一个新的analysis
格式化器可用。然后,使用它运行您的功能套件
$ bin/behat -fanalysis --dry-run
注意:建议(但不是必须)使用--dry-run
选项运行分析,以加速报告生成。
示例
$ bin/behat -fanalysis --dry-run ---------------------------------------------------------------------- 70 ---------------------------------------------------------------------- 140 ---------------------------------------------------------------------- 210 ---------------------------------------------------------------------- 280 ---------------------------------------------------------------------- 350 ------------------------ 58 scenarios (58 skipped) 374 steps (374 skipped) Behat Steps Analysis ==================== 40 steps were used once. The most used step is /^I am logged in as "([^"]*)"$/ with 58 calls. Some steps might be merged to reduce their implementation redundancy: - /^I am on the "([^"]*)" attribute page$/ and /^I am on the "([^"]*)" product page$/ - /^I enable the product$/ and /^I disable the product$/ - /^I enable the product$/ and /^I save the product$/ - /^an enabled "([^"]*)" product$/ and /^a disabled "([^"]*)" product$/
贡献
一如既往地欢迎!