You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature: Added ExcludeOnAttribute and RunOnAttribute (#2512)
* feature: Added `ExcludeOnAttribute` and `RunOnAttribute`
as discussed in #2508
* chore: Updated skip reasons
* test: Added tests for `ExcludeOn` and `RunOn`
* chore: Marked `SkipMacOsAttribute` as obsolete
* chore: Simplified
* fix(test): Updated Public API definition
/// // This test will not run on any supported platform
42
+
/// }
43
+
/// </code>
44
+
/// </example>
45
+
/// <seealso cref="SkipAttribute"/>
46
+
/// <seealso cref="RunOnAttribute"/>
47
+
/// <seealso cref="OS"/>
48
+
publicsealedclassExcludeOnAttribute(OSOperatingSystem):SkipAttribute($"This test is excluded on the following operating systems: `{OperatingSystem}`.")
/// // This test will run on all supported platforms
43
+
/// }
44
+
/// </code>
45
+
/// </example>
46
+
/// <seealso cref="SkipAttribute"/>
47
+
/// <seealso cref="OS"/>
48
+
publicsealedclassRunOnAttribute(OSOperatingSystem):SkipAttribute($"Test is restricted to run on the following operating systems: `{OperatingSystem}`.")
public sealed class ExplicitAttribute : TUnit.Core.TUnitAttribute
403
408
{
@@ -641,6 +646,11 @@ namespace TUnit.Core
641
646
public void OnTestDiscovery(TUnit.Core.DiscoveredTestContext discoveredTestContext) { }
642
647
public virtual System.Threading.Tasks.Task<bool> ShouldRetry(TUnit.Core.TestContext context, System.Exception exception, int currentRetryCount) { }
643
648
}
649
+
public sealed class RunOnAttribute : TUnit.Core.SkipAttribute
650
+
{
651
+
public RunOnAttribute(TUnit.Core.Enums.OS OperatingSystem) { }
652
+
public override System.Threading.Tasks.Task<bool> ShouldSkip(TUnit.Core.BeforeTestContext context) { }
653
+
}
644
654
public class RunOnDiscoveryAttribute : TUnit.Core.TUnitAttribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestDiscoveryEventReceiver
public sealed class ExplicitAttribute : TUnit.Core.TUnitAttribute
434
439
{
@@ -681,6 +686,11 @@ namespace TUnit.Core
681
686
public void OnTestDiscovery(TUnit.Core.DiscoveredTestContext discoveredTestContext) { }
682
687
public virtual System.Threading.Tasks.Task<bool> ShouldRetry(TUnit.Core.TestContext context, System.Exception exception, int currentRetryCount) { }
683
688
}
689
+
public sealed class RunOnAttribute : TUnit.Core.SkipAttribute
690
+
{
691
+
public RunOnAttribute(TUnit.Core.Enums.OS OperatingSystem) { }
692
+
public override System.Threading.Tasks.Task<bool> ShouldSkip(TUnit.Core.BeforeTestContext context) { }
693
+
}
684
694
public class RunOnDiscoveryAttribute : TUnit.Core.TUnitAttribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestDiscoveryEventReceiver
public sealed class ExplicitAttribute : TUnit.Core.TUnitAttribute
434
439
{
@@ -681,6 +686,11 @@ namespace TUnit.Core
681
686
public void OnTestDiscovery(TUnit.Core.DiscoveredTestContext discoveredTestContext) { }
682
687
public virtual System.Threading.Tasks.Task<bool> ShouldRetry(TUnit.Core.TestContext context, System.Exception exception, int currentRetryCount) { }
683
688
}
689
+
public sealed class RunOnAttribute : TUnit.Core.SkipAttribute
690
+
{
691
+
public RunOnAttribute(TUnit.Core.Enums.OS OperatingSystem) { }
692
+
public override System.Threading.Tasks.Task<bool> ShouldSkip(TUnit.Core.BeforeTestContext context) { }
693
+
}
684
694
public class RunOnDiscoveryAttribute : TUnit.Core.TUnitAttribute, TUnit.Core.Interfaces.IEventReceiver, TUnit.Core.Interfaces.ITestDiscoveryEventReceiver
0 commit comments