TUnit.Assertions.Analyzers 0.1.518

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package TUnit.Assertions.Analyzers --version 0.1.518                
NuGet\Install-Package TUnit.Assertions.Analyzers -Version 0.1.518                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TUnit.Assertions.Analyzers" Version="0.1.518" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TUnit.Assertions.Analyzers --version 0.1.518                
#r "nuget: TUnit.Assertions.Analyzers, 0.1.518"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TUnit.Assertions.Analyzers as a Cake Addin
#addin nuget:?package=TUnit.Assertions.Analyzers&version=0.1.518

// Install TUnit.Assertions.Analyzers as a Cake Tool
#tool nuget:?package=TUnit.Assertions.Analyzers&version=0.1.518                

TUnit

T(est)Unit!

Documentation

See here: https://thomhurst.github.io/TUnit/

Speed Comparison

Scenario: A test that takes 50ms to execute, repeated 100 times.

See here for the latest speed test comparisons: https://github.com/thomhurst/TUnit/actions/workflows/speed-comparison.yml?query=branch%3Amain

IDE

TUnit is built on top of newer Microsoft.Testing.Platform libraries, as opposed to older legacy VSTest libraries. As of July 2024, IDEs do not fully support this testing platform yet.

Visual Studio Preview versions can run the new tests by enabling the new testing platform server mode, within Visual Studio preview/experimental features. You will have to opt in to this manually.

For Rider, it is not yet supported. I believe they are working on it so we just have to wait for now.

dotnet CLI - Fully supported. Tests should be runnable with both dotnet test or dotnet run. dotnet run should give you a better experience and make it simpler to pass in test flags!

Features

  • Source generated tests
  • Full async support
  • Parallel by default, with mechanisms to:
    • Run specific tests completely on their own
    • Run specific tests not in parallel with other specific tests
    • Limit the a parallel limit on a per-test, class or assembly level
  • Test ordering (if running not in parallel)
  • Tests can depend on other tests to form chains, useful for if one test depends on state from another action
  • Easy to read assertions
  • Injectable test data via classes, methods, compile-time args, or matrices
  • Hooks before and after:
    • TestDiscover
    • TestSession
    • Assembly
    • Class
    • Test
  • Designed to avoid common pitfalls such as leaky test states
  • Ability to view and interrogate metadata and results from various assembly/class/test context objects

Installation

dotnet add package TUnit --prerelease

Example test

    [Test]
    public async Task Test1()
    {
        var value = "Hello world!";

        await Assert.That(value)
            .Is.Not.Null
            .And.Does.StartWith("H")
            .And.Has.Count().EqualTo(12)
            .And.Is.EqualTo("hello world!", StringComparison.InvariantCultureIgnoreCase);
    }

or with more complex test orchestration needs

    [Before(Class)]
    public static async Task ClearDatabase(ClassHookContext context) { ... }

    [After(Class)]
    public static async Task AssertDatabaseIsAsExpected(ClassHookContext context) { ... }

    [Before(Test)]
    public async Task CreatePlaywrightBrowser(TestContext context) { ... }

    [After(Test)]
    public async Task DisposePlaywrightBrowser(TestContext context) { ... }

    [Retry(3)]
    [Test, DisplayName("Register an account")]
    [EnumerableMethodData(nameof(GetAuthDetails))]
    public async Task Register(string username, string password) { ... }

    [Repeat(5)]
    [Test, DependsOn(nameof(Register))]
    [EnumerableMethodData(nameof(GetAuthDetails))]
    public async Task Login(string username, string password) { ... }

    [Test, DependsOn(nameof(Login), [typeof(string), typeof(string)])]
    [EnumerableMethodData(nameof(GetAuthDetails))]
    public async Task DeleteAccount(string username, string password) { ... }

    [Category("Downloads")]
    [Timeout(300_000)]
    [Test, NotInParallel(Order = 1)]
    public async Task DownloadFile1() { ... }

    [Category("Downloads")]
    [Timeout(300_000)]
    [Test, NotInParallel(Order = 2)]
    public async Task DownloadFile2() { ... }

    [Repeat(10)]
    [Test]
    [Arguments(1)]
    [Arguments(2)]
    [Arguments(3)]
    [DisplayName("Go to the page numbered $page")]
    public async Task GoToPage(int page) { ... }

    [Category("Cookies")]
    [Test, Skip("Not yet built!")]
    public async Task CheckCookies() { ... }

    [Test, Explicit, WindowsOnlyTest, RetryHttpServiceUnavailable(5)]
    [Property("Some Key", "Some Value")]
    public async Task Ping() { ... }

    [Test]
    [ParallelLimit<LoadTestParallelLimit>]
    [Repeat(1000)]
    public async Task LoadHomepage() { ... }

    public static IEnumerable<(string Username, string Password)> GetAuthDetails()
    {
        yield return ("user1", "password1");
        yield return ("user2", "password2");
        yield return ("user3", "password3");
    }

    public class WindowsOnlyTestAttribute : SkipAttribute
    {
        public WindowsOnlyTestAttribute() : base("Windows only test")
        {
        }

        public override Task<bool> ShouldSkip(TestContext testContext)
        {
            return Task.FromResult(!OperatingSystem.IsWindows());
        }
    }

    public class RetryHttpServiceUnavailableAttribute : RetryAttribute
    {
        public RetryHttpServiceUnavailableAttribute(int times) : base(times)
        {
        }

        public override Task<bool> ShouldRetry(TestInformation testInformation, Exception exception, int currentRetryCount)
        {
            return Task.FromResult(exception is HttpRequestException { StatusCode: HttpStatusCode.ServiceUnavailable });
        }
    }

    public class LoadTestParallelLimit : IParallelLimit
    {
        public int Limit => 50;
    }

Motivations

TUnit is inspired by NUnit and xUnit - two of the most popular testing frameworks for .NET.

It aims to build upon the useful features of both while trying to address any pain points that they may have. You may have experienced these, or you may have not even known about them.

Read more here

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.738 0 9/16/2024
0.1.732 9 9/16/2024
0.1.720 33 9/15/2024
0.1.716 36 9/15/2024
0.1.714 33 9/15/2024
0.1.711 32 9/15/2024
0.1.703 222 9/14/2024
0.1.697 118 9/14/2024
0.1.691 169 9/13/2024
0.1.686 74 9/13/2024
0.1.672 301 9/12/2024
0.1.667 124 9/11/2024
0.1.664 64 9/11/2024
0.1.653 176 9/11/2024
0.1.639 247 9/10/2024
0.1.634 116 9/10/2024
0.1.623 257 9/7/2024
0.1.600 522 9/6/2024
0.1.582 251 9/5/2024
0.1.578 84 9/5/2024
0.1.575 74 9/4/2024
0.1.518 301 9/2/2024
0.1.512 1,082 8/30/2024
0.1.508 77 8/29/2024
0.1.506 157 8/28/2024
0.1.505 101 8/28/2024
0.1.504 84 8/28/2024
0.1.503 130 8/27/2024
0.1.502 97 8/27/2024
0.1.497 85 8/27/2024
0.1.495 87 8/27/2024
0.1.492 104 8/16/2024
0.1.491 95 8/15/2024
0.1.486 95 8/9/2024
0.1.481 236 8/8/2024
0.1.479 95 8/8/2024
0.1.476 460 8/7/2024
0.1.474 96 8/7/2024
0.1.472 87 8/7/2024
0.1.471 100 8/7/2024
0.1.470 71 8/7/2024
0.1.469 86 8/7/2024
0.1.467 85 8/7/2024
0.1.465 74 8/7/2024
0.1.460 98 8/6/2024
0.1.459 63 8/6/2024
0.1.458 67 8/5/2024
0.1.457 80 8/1/2024
0.1.456 78 8/1/2024
0.1.455 64 7/31/2024
0.1.454 67 7/30/2024
0.1.442 385 7/13/2024
0.1.441 80 7/13/2024
0.1.440 83 7/13/2024
0.1.439 86 7/13/2024
0.1.438 125 7/12/2024
0.1.434 76 7/12/2024
0.1.433 74 7/12/2024
0.1.430 241 7/11/2024
0.1.428 86 7/10/2024
0.1.424 117 7/9/2024
0.1.423-alpha01 63 7/9/2024
0.1.422-alpha01 63 7/7/2024
0.1.420-alpha01 64 7/7/2024
0.1.419-alpha01 62 7/7/2024
0.1.418-alpha01 64 7/7/2024
0.1.417-alpha01 56 7/7/2024
0.1.416-alpha01 64 7/7/2024
0.1.413-alpha01 60 7/7/2024
0.1.412-alpha01 66 7/7/2024
0.1.411-alpha01 68 7/6/2024
0.1.410-alpha01 69 7/6/2024
0.1.409-alpha01 68 7/5/2024
0.1.407-alpha01 66 7/5/2024
0.1.406-alpha01 72 7/5/2024
0.1.405-alpha01 69 7/5/2024
0.1.404-alpha01 64 7/5/2024
0.1.403-alpha01 59 7/5/2024
0.1.402-alpha01 59 7/5/2024
0.1.401-alpha01 146 7/5/2024
0.1.398-alpha01 60 7/5/2024
0.1.397-alpha01 73 7/4/2024
0.1.395-alpha01 73 7/2/2024
0.1.394-alpha01 67 7/1/2024
0.1.392-alpha01 60 6/30/2024
0.1.391-alpha01 60 6/30/2024
0.1.390-alpha01 58 6/30/2024
0.1.389-alpha01 60 6/30/2024
0.1.386-alpha01 63 6/30/2024
0.1.385-alpha01 55 6/30/2024
0.1.384-alpha01 58 6/30/2024
0.1.383-alpha01 59 6/30/2024
0.1.382-alpha01 73 6/28/2024
0.1.381-alpha01 68 6/26/2024
0.1.380-alpha01 61 6/26/2024
0.1.379-alpha01 178 6/26/2024
0.1.378-alpha01 62 6/26/2024
0.1.377-alpha01 66 6/26/2024
0.1.376-alpha01 65 6/26/2024
0.1.375-alpha01 66 6/25/2024
0.1.374-alpha01 68 6/25/2024
0.1.373-alpha01 69 6/24/2024
0.1.372-alpha01 66 6/24/2024
0.1.371-alpha01 59 6/23/2024
0.1.370-alpha01 69 6/21/2024
0.1.369-alpha01 65 6/21/2024
0.1.368-alpha01 64 6/21/2024
0.1.367-alpha01 74 6/21/2024
0.1.366-alpha01 65 6/21/2024
0.1.365-alpha01 75 6/20/2024
0.1.364-alpha01 71 6/19/2024
0.1.363-alpha01 72 6/19/2024
0.1.362-alpha01 68 6/18/2024
0.1.361-alpha01 67 6/18/2024
0.1.360-alpha01 69 6/18/2024
0.1.359-alpha01 62 6/17/2024
0.1.358-alpha01 59 6/17/2024
0.1.357-alpha01 72 6/16/2024
0.1.356-alpha01 67 6/16/2024
0.1.355-alpha01 63 6/16/2024
0.1.354-alpha01 64 6/16/2024
0.1.353-alpha01 73 6/16/2024
0.1.352-alpha01 73 6/16/2024
0.1.351-alpha01 75 6/14/2024
0.1.350-alpha01 170 6/14/2024
0.1.349-alpha01 72 6/13/2024
0.1.347-alpha01 65 6/12/2024
0.1.346-alpha01 70 6/12/2024
0.1.343-alpha01 68 6/12/2024
0.1.342-alpha01 61 6/12/2024
0.1.341-alpha01 65 6/11/2024
0.1.340-alpha01 62 6/11/2024
0.1.338-alpha01 62 6/11/2024
0.1.336-alpha01 64 6/11/2024
0.1.335-alpha01 61 6/11/2024
0.1.334-alpha01 67 6/11/2024
0.1.333-alpha01 72 6/11/2024
0.1.332-alpha01 68 6/11/2024
0.1.331-alpha01 71 6/11/2024
0.1.330-alpha01 58 6/11/2024
0.1.329-alpha01 67 6/11/2024
0.1.328-alpha01 62 6/11/2024
0.1.327-alpha01 69 6/10/2024
0.1.326-alpha01 66 6/7/2024
0.1.325-alpha01 67 6/7/2024
0.1.324-alpha01 74 6/6/2024
0.1.323-alpha01 78 6/6/2024
0.1.322-alpha01 69 6/3/2024
0.1.321-alpha01 62 6/3/2024
0.1.320-alpha01 69 6/2/2024
0.1.319-alpha01 74 6/2/2024
0.1.318-alpha01 67 6/2/2024
0.1.317-alpha01 67 6/2/2024
0.1.316-alpha01 77 6/2/2024
0.1.315-alpha01 73 5/31/2024
0.1.314-alpha01 73 5/30/2024
0.1.313-alpha01 64 5/30/2024
0.1.312-alpha01 78 5/29/2024
0.1.311-alpha01 72 5/29/2024
0.1.310-alpha01 66 5/29/2024
0.1.309-alpha01 66 5/29/2024
0.1.308-alpha01 69 5/29/2024
0.1.307-alpha01 64 5/29/2024
0.1.306-alpha01 71 5/29/2024
0.1.305-alpha01 69 5/29/2024
0.1.303-alpha01 70 5/29/2024
0.1.302-alpha01 66 5/29/2024
0.1.301-alpha01 71 5/29/2024
0.1.300-alpha01 71 5/28/2024
0.1.299-alpha01 67 5/28/2024
0.1.298-alpha01 81 5/24/2024
0.1.297-alpha01 76 5/24/2024
0.1.296-alpha01 78 5/23/2024
0.1.295-alpha01 73 5/23/2024
0.1.294-alpha01 79 5/23/2024
0.1.293-alpha01 74 5/21/2024
0.1.292-alpha01 80 5/17/2024
0.1.291-alpha01 78 5/17/2024
0.1.290-alpha01 81 5/16/2024
0.1.289-alpha01 82 5/16/2024
0.1.288-alpha01 436 5/16/2024
0.1.287-alpha01 95 5/15/2024
0.1.286-alpha01 78 5/15/2024
0.1.285-alpha01 67 5/15/2024
0.1.284-alpha01 77 5/15/2024
0.1.283-alpha01 69 5/15/2024
0.1.282-alpha01 102 5/15/2024
0.1.281-alpha01 69 5/15/2024
0.1.280-alpha01 74 5/15/2024
0.1.279-alpha01 73 5/15/2024
0.1.278-alpha01 68 5/15/2024
0.1.277-alpha01 75 5/15/2024
0.1.276-alpha01 64 5/15/2024
0.1.275-alpha01 65 5/15/2024
0.1.274-alpha01 60 5/15/2024
0.1.273-alpha01 63 5/15/2024
0.1.272-alpha01 55 5/15/2024
0.1.271-alpha01 79 5/14/2024
0.1.270-alpha01 71 5/14/2024
0.1.269-alpha01 71 5/14/2024
0.1.267-alpha01 70 5/14/2024
0.1.266-alpha01 63 5/14/2024
0.1.265-alpha01 68 5/14/2024
0.1.264-alpha01 70 5/14/2024
0.1.263-alpha01 76 5/14/2024
0.1.262-alpha01 78 5/14/2024
0.1.261-alpha01 70 5/14/2024
0.1.260-alpha01 72 5/14/2024
0.1.259-alpha01 78 5/14/2024
0.1.258-alpha01 94 5/14/2024
0.1.257-alpha01 79 5/14/2024
0.1.256-alpha01 68 5/14/2024
0.1.255-alpha01 72 5/14/2024
0.1.253-pullrequest0116-0276 71 5/14/2024
0.1.253-pullrequest0116-0274 62 5/14/2024
0.1.253-pullrequest0116-0273 64 5/14/2024
0.1.253-alpha01 68 5/14/2024
0.1.252-alpha01 80 5/13/2024
0.1.251-alpha01 70 5/13/2024
0.1.250-alpha01 69 5/13/2024
0.1.249-alpha01 43 5/3/2024
0.1.248-alpha01 105 4/24/2024
0.1.247-alpha01 80 4/16/2024
0.1.246-alpha01 79 4/16/2024
0.1.245-alpha01 68 4/16/2024
0.1.244-alpha01 67 4/16/2024
0.1.243-alpha01 66 4/16/2024
0.1.242-alpha01 66 4/16/2024
0.1.241-alpha01 76 4/16/2024
0.1.240-alpha01 74 4/16/2024
0.1.239-alpha01 78 4/16/2024
0.1.238-alpha01 76 4/16/2024
0.1.237-alpha01 70 4/16/2024
0.1.236-alpha01 73 4/16/2024
0.1.235-alpha01 76 4/16/2024
0.1.234-alpha01 76 4/16/2024
0.1.233-alpha01 79 4/16/2024
0.1.232-pullrequest0073-0043 110 3/25/2024
0.1.232-alpha01 380 3/26/2024
0.1.231-pullrequest0073-0042 82 2/27/2024
0.1.231-pullrequest0073-0041 98 2/27/2024
0.1.231-pullrequest0073-0040 75 2/27/2024
0.1.231-pullrequest0073-0039 76 2/27/2024
0.1.231-pullrequest0073-0038 73 2/27/2024
0.1.231-pullrequest0073-0037 79 2/27/2024
0.1.231-PullRequest0073.3333 69 2/27/2024
0.1.231-alpha01 85 3/8/2024
0.1.230-alpha01 339 2/25/2024
0.1.229-alpha01 94 2/25/2024
0.1.228-alpha01 75 2/25/2024
0.1.227-alpha01 86 2/25/2024
0.1.225-alpha01 71 2/24/2024
0.1.224-alpha01 106 2/24/2024
0.1.223-alpha01 65 2/24/2024
0.1.222-alpha01 87 2/24/2024
0.1.221-alpha01 77 2/24/2024
0.1.219-alpha01 70 2/24/2024
0.1.218-alpha01 69 2/24/2024
0.1.217-alpha01 77 2/24/2024
0.1.216-alpha01 71 2/24/2024
0.1.215-alpha01 74 2/24/2024
0.1.214-alpha01 98 2/24/2024
0.1.213-alpha01 76 2/24/2024
0.1.212-alpha01 75 2/23/2024
0.1.211-alpha01 81 2/22/2024
0.1.210-alpha01 76 2/22/2024
0.1.209-alpha01 69 2/22/2024
0.1.208-alpha01 79 2/21/2024
0.1.207-alpha01 74 2/21/2024
0.1.206-alpha01 77 2/21/2024
0.1.205-alpha01 79 2/21/2024
0.1.204-alpha01 75 2/19/2024
0.1.203-alpha01 73 2/19/2024
0.1.202-alpha01 77 2/19/2024
0.1.201-alpha01 81 2/19/2024
0.1.200-alpha01 72 2/19/2024
0.1.199-alpha01 74 2/19/2024
0.1.198-alpha01 76 2/19/2024
0.1.197-alpha01 73 2/18/2024
0.1.196-alpha01 70 2/18/2024
0.1.194-alpha01 77 2/18/2024
0.1.193-alpha01 74 2/18/2024
0.1.191-alpha01 71 2/18/2024
0.1.190-alpha01 73 2/18/2024
0.1.189-alpha01 80 2/18/2024
0.1.188-alpha01 72 2/18/2024
0.1.187-alpha01 73 2/18/2024
0.1.186-alpha01 71 2/18/2024
0.1.185-alpha01 72 2/18/2024
0.1.184-alpha01 74 2/18/2024
0.1.183-alpha01 72 2/18/2024
0.1.182-alpha01 76 2/18/2024
0.1.181-alpha01 72 2/18/2024
0.1.180-alpha01 73 2/18/2024
0.1.179-alpha01 70 2/18/2024
0.1.178-alpha01 73 2/18/2024
0.1.177-alpha01 77 2/16/2024
0.1.176-alpha01 78 2/16/2024
0.1.175-alpha01 73 2/16/2024
0.1.174-alpha01 72 2/16/2024
0.1.173-alpha01 74 2/16/2024
0.1.172-alpha01 74 2/16/2024
0.1.171-alpha01 71 2/16/2024
0.1.170-alpha01 76 2/16/2024
0.1.169-alpha01 94 2/16/2024
0.1.168-alpha01 76 2/16/2024
0.1.167-alpha01 75 2/16/2024
0.1.166-alpha01 73 2/16/2024
0.1.164-alpha01 72 2/16/2024
0.1.163-alpha01 80 2/16/2024
0.1.162-alpha01 74 2/16/2024
0.1.158-alpha01 77 2/15/2024
0.1.157-alpha01 73 2/15/2024
0.1.155-alpha01 95 2/15/2024
0.1.154-alpha01 79 2/15/2024
0.1.153-alpha01 78 2/15/2024
0.1.152-alpha01 83 2/15/2024
0.1.151-alpha01 73 2/15/2024
0.1.150-alpha01 75 2/15/2024
0.1.149-alpha01 86 2/15/2024
0.1.148-alpha01 82 2/15/2024
0.1.147-alpha01 84 2/15/2024
0.1.146-alpha01 79 2/15/2024
0.1.145-alpha01 84 2/15/2024
0.1.144-alpha01 78 2/15/2024
0.1.143-alpha01 80 2/14/2024
0.1.142-alpha01 77 2/14/2024
0.1.141-alpha01 77 2/14/2024
0.1.140-alpha01 73 2/14/2024
0.1.139-alpha01 68 2/14/2024
0.1.138-alpha01 74 2/14/2024
0.1.137-alpha01 84 2/13/2024
0.1.136-alpha01 87 2/13/2024
0.1.135-alpha01 79 2/13/2024