Qortora · Search · Indexed page
xunit.net Fetched 2026-08-15T05:09:56Z
Home | xUnit.net Home | xUnit.net xUnit.net Table of Contents About xUnit.net xUnit.net is a free, open source, community-focused unit testing tool for C#, F#, and Visual Basic. xUnit.net v3 supports .NET 8.0 or later, and .NET Framework 4.7.2 or later. xUnit.net works with the .NET SDK command l…
Open original source · Full cached text
Home | xUnit.net xUnit.net Table of Contents About xUnit.net xUnit.net is a free, open source, community-focused unit testing tool for C#, F#, and Visual Basic. xUnit.net v3 supports .NET 8.0 or later, and .NET Framework 4.7.2 or later. xUnit.net works with the .NET SDK command line tools, Visual Studio, Visual Studio Code, JetBrains Rider, NCrunch, and any development environment compatible with Microsoft.Testing.Platform or VSTest. xUnit.net is part of the .NET Foundation and operates under a code of conduct. It is licensed under Apache 2 (an OSI approved license). The project is governed by a Project Lead. Follow: xUnit.net on Mastodon, xUnit.net on Bluesky, Brad Wilson, James Newkirk JetBrains Rider support is provided and supported by JetBrains. NCrunch support is provided and supported by Remco Software. The xUnit.net logo was designed by Nathan Young. Quick Start with .NET SDK C# F# Visual Basic Install the xUnit.net v3 project templates: dotnet new install xunit.v3.templates The following template packages will be installed: xunit.v3.templates Success: xunit.v3.templates::2.0.3 installed the following templates: Template Name Short Name Language Tags ------------------------------ ---------------- ---------- ---------- xUnit.net v3 Extension Project xunit3-extension [C#],F#,VB Test/xUnit xUnit.net v3 Test Project xunit3 [C#],F#,VB Test/xUnit Create a unit test project: dotnet new xunit3 --language C# The template "xUnit.net v3 Test Project" was created successfully. Processing post-creation actions... Restoring C:\Dev\SampleProject\SampleProject.csproj: Restore succeeded. Edit UnitTest1.cs: namespace SampleProject; public class UnitTest1 { public static int Add(int x, int y) => x + y; [Fact] public void Good() => Assert.Equal(4, Add(2, 2)); [Fact] public void Bad() => Assert.Equal(5, Add(2, 2)); } Execute the tests: dotnet run xUnit.net v3 In-Process Runner v2.0.3+216a74a292 (64-bit .NET 8.0.17) Discovering: SampleProject Discovered: SampleProject Starting: SampleProject SampleProject.UnitTest1.Bad [FAIL] Assert.Equal() Failure: Values differ Expected: 5 Actual: 4 Stack Trace: UnitTest1.cs(14,0): at SampleProject.UnitTest1.Bad() Finished: SampleProject === TEST EXECUTION SUMMARY === SampleProject Total: 2, Errors: 0, Failed: 1, Skipped: 0, Not Run: 0, Time: 0.054s Install the xUnit.net v3 project templates: dotnet new install xunit.v3.templates The following template packages will be installed: xunit.v3.templates Success: xunit.v3.templates::2.0.3 installed the following templates: Template Name Short Name Language Tags ------------------------------ ---------------- ---------- ---------- xUnit.net v3 Extension Project xunit3-extension [C#],F#,VB Test/xUnit xUnit.net v3 Test Project xunit3 [C#],F#,VB Test/xUnit Create a unit test project: dotnet new xunit3 --language F# The template "xUnit.net v3 Test Project" was created successfully. Processing post-creation actions... Restoring C:\Dev\SampleProject\SampleProject.fsproj: Restore succeeded. Edit UnitTest1.fs: module UnitTest1 open Xunit let Add(x: int, y: int) = x + y [<Fact>] let Good() = Assert.Equal(4, Add(2, 2)) [<Fact>] let Bad() = Assert.Equal(5, Add(2, 2)) Execute the tests: dotnet run dotnet run xUnit.net v3 In-Process Runner v2.0.3+216a74a292 (64-bit .NET 8.0.17) Discovering: SampleProject Discovered: SampleProject Starting: SampleProject UnitTest1.Bad [FAIL] Assert.Equal() Failure: Values differ Expected: 5 Actual: 4 Stack Trace: UnitTest1.fs(14,0): at UnitTest1.Bad() Finished: SampleProject === TEST EXECUTION SUMMARY === SampleProject Total: 2, Errors: 0, Failed: 1, Skipped: 0, Not Run: 0, Time: 0.052s Install the xUnit.net v3 project templates: dotnet new install xunit.v3.templates The following template packages will be installed: xunit.v3.templates Success: xunit.v3.templates::2.0.3 installed the following templates: Template Name Short Name Language Tags ------------------------------ ---------------- ---------- ---------- xUnit.net v3 Extension Project xunit3-extension [C#],F#,VB Test/xUnit xUnit.net v3 Test Project xunit3 [C#],F#,VB Test/xUnit Create a unit test project: dotnet new xunit3 --language VB The template "xUnit.net v3 Test Project" was created successfully. Processing post-creation actions... Restoring C:\Dev\SampleProject\SampleProject.vbproj: Restore succeeded. Edit UnitTest1.vb: Imports Xunit Public Class UnitTest1 Public Function Add(x As Integer, y As Integer) As Integer Return x + y End Function <Fact> Public Sub Good() Assert.Equal(4, Add(2, 2)) End Sub <Fact> Public Sub Bad() Assert.Equal(5, Add(2, 2)) End Sub End Class Execute the tests: dotnet run dotnet run xUnit.net v3 In-Process Runner v2.0.3+216a74a292 (64-bit .NET 8.0.17) Discovering: SampleProject Discovered: SampleProject Starting: SampleProject SampleProject.UnitTest1.Bad [FAIL] Assert.Equal() Failure: Values differ Expected: 5 Actual: 4 Stack Trace: UnitTest1.vb(16,0): at SampleProject.UnitTest1.Bad() Finished: SampleProject === TEST EXECUTION SUMMARY === SampleProject Total: 2, Errors: 0, Failed: 1, Skipped: 0, Not Run: 0, Time: 0.052s Latest Release Notes Stable Prerelease Core Framework v3 4.0.0 None Core Framework v2 [1] 2.9.3 None Analyzers 2.0.0 None Visual Studio adapter 4.0.0 None For older release notes, see the full release notes list. Latest NuGet Packages Latest stable Latest CI (how to use) Build status xunit.v3 xunit [1] xunit.analyzers xunit.runner.visualstudio Issues and Discussions Issues in the core framework and analyzers should be reported in the primary issue tracker Issues in xunit.runner.visualstudio should be reported in the project issue tracker Discussions are hosted in the primary discussion forums Github Projects xUnit.net (core framework, built-in runners) Assertion library Analyzers Visual Studio adapter Media files This site Links to Resources Visual Studio Community MSBuild Reference Sponsors Help support this project by becoming a sponsor through GitHub Sponsors. Additional copyrights Portions copyright The Legion Of The Bouncy Castle Footnotes Core Framework v2 is in maintenance mode. Critical bug fixes will be issued, but no new feature work is being done. All new features are taking place with Core Framework v3 only. Developers are encouraged to upgrade from v2 to v3 at their earliest convenience. Edit this page Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit.net. Updates posted to Mastodon and Bluesky. Outline Table of Contents About xUnit.net Quick Start with .NET SDK Latest Release Notes Latest NuGet Packages Issues and Discussions Github Projects Links to Resources Sponsors Additional copyrights Presented by Qortora, a product of Qortora, LLC. Content remains the property of the original publisher. This reference page supports transparent discovery within the Qortora index.