PHPackages                             chekote/behat-retry-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. chekote/behat-retry-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

chekote/behat-retry-extension
=============================

Automatically retry "Then" steps in Behat

v1.2.0(9mo ago)10138.6k↓11.7%3[2 issues](https://github.com/Chekote/BehatRetryExtension/issues)[2 PRs](https://github.com/Chekote/BehatRetryExtension/pulls)MITPHPCI passing

Since Nov 19Pushed 9mo agoCompare

[ Source](https://github.com/Chekote/BehatRetryExtension)[ Packagist](https://packagist.org/packages/chekote/behat-retry-extension)[ RSS](/packages/chekote-behat-retry-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (10)Used By (0)

[![Packagist Latest Stable Version](https://camo.githubusercontent.com/477059543fa8dead16089b5188752d17c81bf517a549d96bcaf97e8f1289b5cd/68747470733a2f2f706f7365722e707567782e6f72672f6368656b6f74652f62656861742d72657472792d657874656e73696f6e2f76657273696f6e2e737667)](https://packagist.org/packages/chekote/behat-retry-extension)[![Packagist Latest Unstable Version](https://camo.githubusercontent.com/ff867b075ab508129d63a53203481ab8162aecb05de11f53dc7ebbdbce3fb56b/68747470733a2f2f706f7365722e707567782e6f72672f6368656b6f74652f62656861742d72657472792d657874656e73696f6e2f762f756e737461626c652e737667)](https://packagist.org/packages/chekote/behat-retry-extension)[![Packagist Total Downloads](https://camo.githubusercontent.com/6440452c22cc471741a51bcd6b6c5038a8eb3f0b98de13715af3780590c7f1dc/68747470733a2f2f706f7365722e707567782e6f72672f6368656b6f74652f62656861742d72657472792d657874656e73696f6e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/chekote/behat-retry-extension)[![CircleCI](https://camo.githubusercontent.com/19b06e239d70197c4d02fa5e2af709a9194f2e1c0f7cc1638fb549c0754b538a/68747470733a2f2f636972636c6563692e636f6d2f67682f4368656b6f74652f42656861745265747279457874656e73696f6e2e7376673f7374796c653d736869656c64)](https://circleci.com/gh/Chekote/BehatRetryExtension)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3bc5014239048620d564d5f3b735cc7d935051548deb70aba877dcf5e8c75489/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4368656b6f74652f42656861745265747279457874656e73696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Chekote/BehatRetryExtension/?branch=master)[![StyleCI](https://camo.githubusercontent.com/b6c9ce0a5f772ebf64347a3e07be87109a86c7d467968678504196ee5983a2ee/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131303735343135332f736869656c643f7374796c653d706c6173746963)](https://styleci.io/repos/110754153)

Behat Retry Extension
=====================

[](#behat-retry-extension)

Automatically spin (retry) "Then" steps in Behat

Usage
-----

[](#usage)

1. Add it to your requirements (typically dev only)

```
composer require --dev chekote/behat-retry-extension
```

2. Enable the extension:

```
# behat.yml
default:
    # ...
    extensions:
        Chekote\BehatRetryExtension: ~
```

3. Optionally configure the extension

```
# behat.yml
default:
    # ...
    extensions:
        Chekote\BehatRetryExtension:
          timeout: 10
          interval: 999999999
          strictKeywords: true
```

Configuration Options
---------------------

[](#configuration-options)

### Timeout

[](#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

[](#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

[](#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
-----------

[](#development)

### pre-requisites

[](#pre-requisites)

Install [Docker](https://www.docker.com).

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

[](#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

[](#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

```

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 90% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~942 days

Total

4

Last Release

276d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/550486?v=4)[Donald Tyler](/maintainers/Chekote)[@Chekote](https://github.com/Chekote)

---

Top Contributors

[![Chekote](https://avatars.githubusercontent.com/u/550486?v=4)](https://github.com/Chekote "Chekote (36 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![lorenzodalaqua](https://avatars.githubusercontent.com/u/8523099?v=4)](https://github.com/lorenzodalaqua "lorenzodalaqua (1 commits)")

---

Tags

asynchronoustestrace conditionretry

### Embed Badge

![Health badge](/badges/chekote-behat-retry-extension/health.svg)

```
[![Health](https://phpackages.com/badges/chekote-behat-retry-extension/health.svg)](https://phpackages.com/packages/chekote-behat-retry-extension)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.1M147](/packages/drupal-drupal-extension)[friends-of-behat/mink-extension

Mink extension for Behat

14034.2M467](/packages/friends-of-behat-mink-extension)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

593.6M37](/packages/dvdoug-behat-code-coverage)[robertfausk/behat-panther-extension

Symfony Panther extension for Behat

341.7M87](/packages/robertfausk-behat-panther-extension)[bshaffer/phpunit-retry-annotations

Traits for retrying test methods and classes in PHPUnit

23482.5k2](/packages/bshaffer-phpunit-retry-annotations)[leanphp/behat-code-coverage

Generate Code Coverage reports for Behat tests

50359.8k2](/packages/leanphp-behat-code-coverage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
