XUnit.net Logo.png
XUnit.net GUI.png
xUnit.net 1.9.1 GUI on Windows
Original author(s)James Newkirk, Brad Wilson[1]
Developer(s)Microsoft, Outercurve Foundation, .NET Foundation
Stable release
2.4.1[2] / October 29, 2018; 3 years ago (2018-10-29)
Written inC#
Operating systemWindows, macOS, Linux
Platform.NET Framework, .NET Core,[3] Mono
TypeUnit testing tool
LicenseApache License 2.0

xUnit.net is a free and open-source unit testing tool for the .NET Framework, written by the original author of NUnit. It is licensed under Apache License 2.0 and the source code is available on GitHub.[4] xUnit.net works with Xamarin, ReSharper, CodeRush, and TestDriven.NET.[5]


Example of an xUnit.net test fixture:

using Xunit;

public class MyTests
    public void MyTest()
        Assert.Equal(4, 2 + 2);

After you compile the test, run it in your console:

C:\MyTests\bin\Debug> xunit.console MyTestLibrary.dll
xUnit.net console test runner (64-bit .NET 2.0.50727.0)
Copyright (C) 2007-11 Microsoft Corporation.

xunit.dll:     Version
Test assembly: C:\MyTests\bin\Debug\MyTestLibrary.dll

1 total, 0 failed, 0 skipped, took 0.302 seconds

See also[]


  1. ^ "Leaving Microsoft". Brad Wilson.
  2. ^ "Releases · xunit/xunit". GitHub.
  3. ^ "How to Test ASP.NET Core Web API". InfoQ.
  4. ^ "About xUnit.net". GitHub. 4 November 2021.
  5. ^ Kanjilal, Joydip (February 10, 2017). "How to work with xUnit.Net framework". InfoWorld.

External links[]