With this release, the core xUnit.net framework has been moved to release candidate, while the DNX runner will continue on its beta path. There have been significant improvements in the core framework that are ready for production use, whereas the DNX runner remains on a beta path while DNX itself does.
IAsyncLifetime
interface is available, which can be
placed onto test classes, class fixtures, and collection fixtures. This
allows asynchonous initialization (InitializeAsync
) and
cleanup (DisposeAsync
).
<collection>
elements were
not correctly generated in the XML output (tests were not always grouped
into the correct collection).
Task
in theory data might cause
the discoverer to hang while it attempted to create a string representation
of the task.
Type
objects from
types in the GAC could cause the Visual Studio runner to fail.
For information on using configuration files with xUnit.net, see Configuration Files.
<AssemblyName>.xunit.runner.json
instead of
just xunit.runner.json
if you need to be able to disambiguate
between configuration files for multiple test assemblies in the same
output folder.
shadowCopy
configuration file element was added, a
boolean value with a default of true
. This value is only used
when app domains are being used; it is ignored when app domains are not
available or not being used.
useAppDomain
configuration file element was renamed
to appDomain
and it value is now an enumeration rather
than a boolean. This value is only used when app domain support is
available (unit tests that target the desktop CLR, being run by a
desktop runner).
desktop
(for anything which targets the
desktop CLR only, and includes support for app domains), and
dotnet
(for everything else, including PCLs, which does not
include support for app domains). The new runner libraries can run older tests,
but the older runner libraries cannot run the newer dotnet
tests
(since it's a new platform), so runner authors for non-desktop platforms are
strongly encouraged to upgrade to the 2.1 runner libraries for maximum
compatibility. Developers who write extensions to xUnit.net can now do so
with just two versions instead of eight.
AssemblyRunner
has been added to the
xunit.runner.utility
library which makes it easy to write a
simple test runner. This is useful for developers who want to reuse the
test framework in an embedded fashion (for example, as a Best Practices
Analyzer). There is a sample
project which shows how it is used.
-failskips
switch which turns skipped tests into
failures.
-namespace
filter which allows for filtering tests
based on their namespace. This filter works for partial namespaces; for
example, passing -namespace Foo would run tests in the
Foo
namespace, plus tests in all the child namespaces of
Foo
(like Foo.Bar
or Foo.Bar.Baz
).
FailSkips="true"
attribute which turns skipped tests
into failures.
For information on using xUnit.net from within Visual Studio, see Running xUnit.net tests in Visual Studio.
shadowCopy
option
in configuration files. Note: if you turn off shadow copying, then your
test assembly files will be locked during discovery and execution, preventing
you from building or cleaning your project.
For information on using xUnit.net from DNX projects, see Getting Started with DNX.
-namespace
filter which allows for filtering tests
based on their namespace. This filter works for partial namespaces; for
example, passing -namespace Foo would run tests in the
Foo
namespace, plus tests in all the child namespaces of
Foo
(like Foo.Bar
or Foo.Bar.Baz
).