chekote/behat-retry-extension
Composer 安装命令:
composer require chekote/behat-retry-extension
包简介
Automatically retry "Then" steps in Behat
README 文档
README
Behat Retry Extension
Automatically spin (retry) "Then" steps in Behat
Usage
- Add it to your requirements (typically dev only)
composer require --dev chekote/behat-retry-extension
- Enable the extension:
# behat.yml default: # ... extensions: Chekote\BehatRetryExtension: ~
- Optionally configure the extension
# behat.yml default: # ... extensions: Chekote\BehatRetryExtension: timeout: 10 interval: 999999999 strictKeywords: true
Configuration Options
Timeout
Type: Float
Default: 5
The timeout setting is the number of seconds that the extension should retry "Then" steps until they are considered a failure.
This can be overriden by setting the BEHAT_RETRY_TIMEOUT environment variable (e.g. BEHAT_RETRY_TIMEOUT=0 behat ...args...) for setting custom timeouts for a specific execution.
Interval
Type: Integer
Default: 100000000 (0.1 seconds)
The interval is how many nanoseconds the extension will wait between attempts. The default is to attempt 10 times a second. Attempting the retry more frequently will potentially allow your tests to pass quicker, but this depends on your environment.
It is possible that attempting the assertion too frequently will put a load on your application in such a way that the tests actually take longer to run. You will need to experiment with your particular application to determine what setting is best for you.
Strict Keywords
Type: Boolean
Default: true
When enabled, the Strict Keywords setting will only allow a step definition to be invoked if the correct keyword is used. For example, you cannot invoke a step definition of "Then I should see..." by using "Given I should see..." or "When I should see...". Note that when using "And" or "But", the extension will understand the context and consider these to be the same as the previous keyword. For example, the following "But" would be considered a "Then" as far as this extension is concerned:
Given I visit "/home" Then I should see "Welcome" But I should not see "Logout"
This setting defaults to true and it is highly recommended that you do not disable it. If this feature is disabled, it will allow a developer to use "Then" to invoke a non-Then step, causing the extension to spin a "Given" or a "When". Equally problematic, disabling this feature will allow a developer to use a "Given" or "When" to invoke a "Then", preventing the extension from spinning the "Then" step.
Development
pre-requisites
Install Docker.
You will also want to ensure that ./bin is in your $PATH and is the highest priority. You can do so by adding the following to your shell profile:
export PATH=./bin:$PATH
Setting up the project for development
Clone the repository:
git clone git@github.com:Chekote/BehatRetryExtension.git
cd BehatRetryExtension
Initialize the project:
init_project
Tooling
The project includes a set of command line tools (such as php, etc) located in the bin folder. These can be run from anywhere on your machine and will execute as if they were the tools installed natively on your machine.
These commands will spin up temporary Docker containers to run your commands.
These command line tools have no requirements other than having Docker toolbox installed.
Note: If you are using the zsh terminal, you will need to unset the cdablevars option, otherwise you will be unable to execute any of the binaries that match usernames on your system, such as mysql:
.zshrc
# Options
unsetopt cdablevars
chekote/behat-retry-extension 适用场景与选型建议
chekote/behat-retry-extension 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 141.73k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2017 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「test」 「retry」 「asynchronous」 「race-condition」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chekote/behat-retry-extension 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chekote/behat-retry-extension 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chekote/behat-retry-extension 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Asynchronous coroutines for PHP 7.
Emulated timeouts for synchronous operations.
Testing Suite For Lumen like Laravel does.
Retry tasks that fail due to transient faults
Polling library for conditionally retry operations based on a result checker.
Symfony ResqueBundle
统计信息
- 总下载量: 141.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-18