<PackageReference Include="NUnit" Version="3.2.0" />

TestActionAttribute

public abstract class TestActionAttribute : Attribute, ITestAction
Provide actions to execute before and after tests.
using NUnit.Framework.Interfaces; using System; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)] public abstract class TestActionAttribute : Attribute, ITestAction { public virtual ActionTargets Targets => ActionTargets.Default; public virtual void BeforeTest(ITest test) { } public virtual void AfterTest(ITest test) { } } }