2017 © Pedro Peláez
 

behat-extension behat-retry-extension

Automatically retry "Then" steps in Behat

image

chekote/behat-retry-extension

Automatically retry "Then" steps in Behat

  • Sunday, December 3, 2017
  • by Chekote
  • Repository
  • 0 Watchers
  • 2 Stars
  • 288 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 49 % Grown

The README.md

Packagist Latest Stable Version Packagist Latest Unstable Version Packagist Total Downloads CircleCI Scrutinizer Code Quality StyleCI, (*1)

Behat Retry Extension

Automatically spin (retry) "Then" steps in Behat, (*2)

Usage

  1. Add it to your requirements (typically dev only)
composer require --dev chekote/behat-retry-extension
  1. Enable the extension:
# behat.yml
default:
    # ...
    extensions:
        Chekote\BehatRetryExtension: ~
  1. Optionally configure the extension
# behat.yml
default:
    # ...
    extensions:
        Chekote\BehatRetryExtension:
          timeout: 10
          interval: 999999999
          strictKeywords: true

Configuration Options

Timeout

Type: Float, (*3)

Default: 5, (*4)

The timeout setting is the number of seconds that the extension should retry "Then" steps until they are considered a failure., (*5)

Interval

Type: Integer, (*6)

Default: 100000000 (0.1 seconds), (*7)

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., (*8)

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., (*9)

Strict Keywords

Type: Boolean, (*10)

Default: true, (*11)

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:, (*12)

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., (*13)

Development

pre-requisites

Install Docker., (*14)

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:, (*15)

export PATH=./bin:$PATH

Setting up the project for development

Clone the repository:, (*16)

git clone git@github.com:Chekote/BehatRetryExtension.git
cd BehatRetryExtension

Initialize the project:, (*17)

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., (*18)

These commands will spin up temporary Docker containers to run your commands., (*19)

These command line tools have no requirements other than having Docker toolbox installed., (*20)

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:, (*21)

.zshrc, (*22)

# Options
unsetopt cdablevars

The Versions

03/12 2017

dev-master

9999999-dev

Automatically retry "Then" steps in Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Donald Tyler

test asynchronous retry race-condition

20/11 2017

dev-composer

dev-composer

Automatically retry "Then" steps in Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Donald Tyler

test asynchronous retry race-condition

19/11 2017

v1.0

1.0.0.0

Automatically retry "Then" steps in Behat

  Sources   Download

MIT

The Requires

 

The Development Requires

by Donald Tyler