-
Notifications
You must be signed in to change notification settings - Fork 291
RetryAttribute to support decoration of class and/or assembly #7556
Copy link
Copy link
Open
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)
Description
Summary
Currently, [RetryAttribute] doesn't support decoration of a class or an assembly. This feature request aim to overcome such a limitation.
Background and Motivation
Currently, the attribute is defined as of version 4.0.2:
[AttributeUsage(
AttributeTargets.Method, AllowMultiple=false,
Inherited=false)]
public sealed class RetryAttribute : RetryBaseAttributeThis results in a test method like this:
[TestClass]
public class MyEndToEndIntegrationTests
{
[TestMethod, Retry(3)]
public void TestA() {}
[TestMethod, Retry(3)]
public void TestB() {}
[TestMethod, Retry(3)]
public void TestC() {}
}Proposed Feature
Instead, the attribute would be defined as this:
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Class,
AllowMultiple=false, Inherited=false)]
public sealed class RetryAttribute : RetryBaseAttributeOr even this:
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly,
AllowMultiple=false, Inherited=false)]
public sealed class RetryAttribute : RetryBaseAttributeResulting in a test class like this:
[TestClass, Retry(3)]
public class MyEndToEndIntegrationTests
{
[TestMethod]
public void TestA() {}
[TestMethod]
public void TestB() {}
[TestMethod]
public void TestC() {}
}Or even this:
[assembly: Retry(3)]Aspects to consider:
- Can a test method override (make it smaller or greater) the value set at a higher level (class, assembly)? If yes, what would be the behavior (permit, ignore, throw)?
Alternative Designs
N/D
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)