diff --git a/README.md b/README.md index a6c65dc..81b0879 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,62 @@ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Chekote/BehatRetryExtension/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Chekote/BehatRetryExtension/?branch=master) [![StyleCI](https://styleci.io/repos/110754153/shield?style=plastic)](https://styleci.io/repos/110754153) -# behat-then-spinner +# Behat Retry Extension Automatically spin (retry) "Then" steps in Behat -## Development pre-requisites +## Usage + +1. Add it to your requirements (typically dev only) + +```bash +composer require --dev chekote/behat-retry-extension +``` + +2. Enable the extension: + +```yaml +# behat.yml +default: + # ... + extensions: + Chekote\BehatRetryExtension +``` + +3. Optionally configure the extension + +```yaml +# behat.yml +default: + # ... + extensions: + Chekote\BehatRetryExtension: + timeout: 10 + interval: 1000000000 +``` + +## 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. + +### 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. + +## Development + +### pre-requisites Install [Docker](https://www.docker.com). @@ -18,7 +70,7 @@ You will also want to ensure that `./bin` is in your `$PATH` and is the highest export PATH=./bin:$PATH ``` -## Setting up the project for development +### Setting up the project for development Clone the repository: @@ -33,7 +85,7 @@ 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. diff --git a/src/Chekote/BehatRetryExtension/Tester/RuntimeStepTester.php b/src/Chekote/BehatRetryExtension/Tester/RuntimeStepTester.php index fde44c2..12af24b 100644 --- a/src/Chekote/BehatRetryExtension/Tester/RuntimeStepTester.php +++ b/src/Chekote/BehatRetryExtension/Tester/RuntimeStepTester.php @@ -30,7 +30,7 @@ */ final class RuntimeStepTester implements StepTester { - /** Number of seconds to attempt "Then" steps before accepting a failure */ + /** @var float Number of seconds to attempt "Then" steps before accepting a failure */ public static $timeout; /** @var int number of nanoseconds to wait between each retry of "Then" steps */