RetryBaseAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
一个抽象属性,用于控制在测试方法失败时重试测试方法。 由派生类决定如何完成重试。
[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
- 继承
-
RetryBaseAttribute
- 派生
- 属性
注解
应用于测试类时,该属性将用作在类上声明的每个测试方法的默认值。 直接放置在测试方法上的重试属性优先于类级别 1。 属性不继承:将其应用于基测试类不会将其应用于派生的测试类。
运行程序仅在初始(非重试)运行产生不可接受的结果后调用ExecuteAsync(RetryContext),即至少有一个Failed生成的Microsoft.VisualStudio.TestTools.UnitTesting.TestResult条目具有或Timeout结果。 它本身不会在后续尝试时重新运行测试:输入后 ExecuteAsync(RetryContext) ,派生的实现将拥有重试循环,并决定何时停止。 派生类型可以使用 IsAcceptableResultForRetry (同样 RetryAttribute )或实现任何其他策略。
构造函数
| 名称 | 说明 |
|---|---|
| RetryBaseAttribute() |
一个抽象属性,用于控制在测试方法失败时重试测试方法。 由派生类决定如何完成重试。 |
方法
| 名称 | 说明 |
|---|---|
| ExecuteAsync(RetryContext) |
重试测试方法。 重试方式的详细信息留给派生类。 请注意,在调用此方法之前,已执行并失败了该方法的第一次运行。 |