Download the PHP package bshaffer/phpunit-retry-annotations without Composer
On this page you can find all versions of the php package bshaffer/phpunit-retry-annotations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bshaffer/phpunit-retry-annotations
More information about bshaffer/phpunit-retry-annotations
Files in bshaffer/phpunit-retry-annotations
Package phpunit-retry-annotations
Short Description Traits for retrying test methods and classes in PHPUnit
License Apache-2.0
Homepage https://github.com/bshaffer/phpunit-retry
Informations about the package phpunit-retry-annotations
PHPUnit Retry
Traits for retrying test methods and classes in PHPUnit.
Installation
Configuring retries
Retry using a specified number of retries
NOTE: "Attempts" represents the number of times a test is retried. Providing "@retryAttempts" a value of 0 has no effect, and would not retry.
Retry until a specific duration has passed
Configuring retry conditions
Retry only for certain exceptions
By default, retrying happens when any exception other than
PHPUnit\Framework\IncompleteTestError
and PHPUnit\Framework\SkippedTestError
is thrown.
Because you may not always want to retry, you can configure your test to only retry under certain conditions. For example, you can only retry if your tests throw a certain exception.
You can retry for multiple exceptions.
Retry based on a custom method
For more complex logic surrounding whether you should retry, define a custom retry method:
Define arbitrary arguments for your retry method by passing them into the annotation:
Configuring delay
Delay for a duration between each retry
Delay for an amount increasing exponentially based on the retry attempt
The behavior of the exponentialBackoff
method is to start at 1
second and increase to a maximum of 60 seconds. The maximum delay can be
customized by supplying a second argument to the annotation
Define a custom delay method
Define arbitrary arguments for your delay function by passing them into the annotation: