Download the PHP package keboola/phpunit-retry-annotations without Composer
On this page you can find all versions of the php package keboola/phpunit-retry-annotations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download keboola/phpunit-retry-annotations
More information about keboola/phpunit-retry-annotations
Files in keboola/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/keboola/phpunit-retry-annotations
Informations about the package phpunit-retry-annotations
PHPUnit Retry
Traits for retrying test methods and classes in PHPUnit.
Installation
Configuring retries
The default retries count is set to 3, when you want to change default retries for all tests copy&paste file phpunit-retry.xml.dist
from this library into the root directory
of your application and change value of baseRetryCount
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:
All versions of phpunit-retry-annotations with dependencies
ext-dom Version *