Поделиться через


RetryAttribute Class

Definition

This attribute is used to set a retry count on a test method in case of failure.

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed class RetryAttribute : Microsoft.VisualStudio.TestTools.UnitTesting.RetryBaseAttribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type RetryAttribute = class
    inherit RetryBaseAttribute
Public NotInheritable Class RetryAttribute
Inherits RetryBaseAttribute
Inheritance
RetryAttribute
Attributes

Constructors

RetryAttribute(Int32)

Initializes a new instance of the RetryAttribute class with the given number of max retries.

Properties

BackoffType

Gets or sets the delay backoff type.

MaxRetryAttempts

Gets the number of retries that the test should make in case of failures. Note that before RetryAttribute is considered, the test was already executed once. This property determines the max number of retries after the first normal run.

MillisecondsDelayBetweenRetries

Gets or sets the delay, in milliseconds, between retries. This delay is also applied after the first run and before the first retry attempt.

Methods

ExecuteAsync(RetryContext)

Retries the test method. The details of how retry is done is left to the derived classes. Note that a first run of the method was already executed and failed before this method is called.

(Inherited from RetryBaseAttribute)

Applies to