Home

xUnitnet

xUnit.net, commonly referred to as xUnit.net, is a free, open-source unit testing framework for .NET languages. It supports .NET Framework, .NET Core, and .NET 5+ applications, and runs on Windows, Linux, and macOS via the .NET runtime. It is designed as a modern alternative to other frameworks like NUnit and MSTest, emphasizing a simple attribute-based syntax and a test-driven development workflow. Tests are discovered and executed by test runners such as dotnet test, Visual Studio, or third-party runners.

Test methods are decorated with [Fact] for simple tests or [Theory] for data-driven tests. Theories use data

xUnit.net ships as NuGet packages: xunit for framework APIs, xunit.runner.visualstudio for Visual Studio integration, and xunit.runner.dotnet

attributes
such
as
[InlineData],
[MemberData],
or
[ClassData].
Each
test
runs
in
a
separate
instance
of
the
test
class
by
default,
enabling
isolation.
Setup
and
teardown
are
handled
via
constructors
and
IDisposable,
or
through
fixtures
using
IClassFixture
and
ICollectionFixture
to
share
context
across
tests
or
test
classes.
The
framework
supports
parallel
test
execution,
configurable
via
attributes
and
config
files,
and
allows
skipping
tests
with
a
Skip
property.
for
dotnet
test
compatibility.
It
integrates
with
commonly
used
test
runners
and
supports
dependency
injection
in
tests
through
custom
fixtures.
It
has
an
active
community
and
ecosystem
of
extensions
and
tools.