Idioma

RetryBaseAttribute Classe

Definição

Um atributo abstrato que controla a repetição de um método de teste se ele falhou. Cabe às classes derivadas definir como a repetição é feita.

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public abstract class RetryBaseAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
[System.Runtime.CompilerServices.Nullable(0)]
public abstract class RetryBaseAttribute : Attribute
[System.Runtime.CompilerServices.Nullable(0)]
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public abstract class RetryBaseAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public abstract class RetryBaseAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type RetryBaseAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type RetryBaseAttribute = class
    inherit Attribute
[<System.Runtime.CompilerServices.Nullable(0)>]
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type RetryBaseAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]
type RetryBaseAttribute = class
    inherit Attribute
Public MustInherit Class RetryBaseAttribute
Inherits Attribute
Herança
RetryBaseAttribute
Derivado
Atributos

Comentários

Quando aplicado a uma classe de teste, o atributo é usado como padrão para cada método de teste declarado na classe. Um atributo de repetição colocado diretamente em um método de teste tem precedência sobre um nível de classe. O atributo não é herdado: a aplicação a uma classe de teste base não o aplica a classes de teste derivadas.

O executor invoca ExecuteAsync(RetryContext) somente após a execução inicial (não repetição) produzir um resultado inaceitável, ou seja, pelo menos uma das entradas produzidas Microsoft.VisualStudio.TestTools.UnitTesting.TestResult teve um resultado ou Timeout um Failed resultado. Ele não executa novamente o teste em tentativas subsequentes: uma vez ExecuteAsync(RetryContext) inserida, a implementação derivada possui o loop de repetição e decide quando parar. Tipos derivados podem usar IsAcceptableResultForRetry (como RetryAttribute faz) ou implementar qualquer outra política.

Construtores

Nome Description
RetryBaseAttribute()

Um atributo abstrato que controla a repetição de um método de teste se ele falhou. Cabe às classes derivadas definir como a repetição é feita.

Métodos

Nome Description
ExecuteAsync(RetryContext)

Tenta novamente o método de teste. Os detalhes de como a repetição é feita são deixados para as classes derivadas. Observe que uma primeira execução do método já foi executada e falhou antes de esse método ser chamado.

Aplica-se a