Here are TUnit's equivalent attributes to other test frameworks.
Test Attributesâ
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Test] | [Fact] | [Test] | [TestMethod] |
| [Test] | [Theory] | [TestCase] | [DataTestMethod] |
| [Test] | [Theory] | [TestCaseSource] | [DataTestMethod] |
| [Test] | - | [Combinatorial] | - |
Data Injection Attributesâ
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Arguments] | [InlineData] | [TestCase] | [DataRow] |
| [ClassDataSource] | [ClassData] or IClassFixture<T> | [TestCaseSource] | - |
| [MethodDataSource] | [MemberData] | [TestCaseSource] | [DynamicData] |
| [Matrix] | - | [Values] | - |
Test Control Attributesâ
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Repeat] | - | [Repeat] | - |
| [Retry] | - | [Retry] | - |
| [Skip] | [Fact(Skip="")] | [Ignore] | [Ignore] |
| [Timeout] | - | [TimeOut] | - |
| [Explicit] | - | [Explicit] | - |
| [NotInParallel] | [CollectionDefinition(DisableParallelization = true)] | [LevelOfParallelism] | - |
Lifecycle Hook Attributesâ
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Before(Test)] | < Constructor > | [SetUp] | [TestInitialize] |
| [After(Test)] | IDisposable.Dispose | [TearDown] | [TestCleanup] |
| [Before(Class)] | IClassFixture<T> | [OneTimeSetUp] | [ClassInitialize] |
| [After(Class)] | IClassFixture<T> + IDisposable.Dispose | [OneTimeTearDown] | [ClassCleanup] |
| [Before(Assembly)] | - | [SetUpFixture] + [OneTimeSetUp] | [AssemblyInitialize] |
| [After(Assembly)] | - | [SetUpFixture] + [OneTimeTearDown] | [AssemblyCleanup] |
| [Before(TestSession)] | - | - | - |
| [After(TestSession)] | - | - | - |
| [Before(TestDiscovery)] | - | - | - |
| [After(TestDiscovery)] | - | - | - |
| [BeforeEvery(Test)] | - | - | - |
| [AfterEvery(Test)] | - | - | - |
| [BeforeEvery(Class)] | - | - | - |
| [AfterEvery(Class)] | - | - | - |
| [BeforeEvery(Assembly)] | - | - | - |
| [AfterEvery(Assembly)] | - | - | - |
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Category] | [Trait("Category","")] | [Category] | [TestCategory] |
| [Property] | [Trait] | [Property] | [TestProperty] |
Culture-sensitive Attributesâ
| TUnit | xUnit | NUnit | MSTest |
|---|
| [Culture("en-US")] | - | [SetCulture("en-US")] | - |
| - | - | [Culture("en-US")] | - |
| - | - | [SetUICulture("en-US") | - |