Core Framework v2 2.4.0 2018 July 16
Today, we're shipping three new releases:
- xUnit.net Core Framework v2
2.4.0 - xUnit.net Visual Studio adapter 2.4.0
It's been nearly 9 months since the release of 2.3.1.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Release Notes
These release notes are a comprehensive list of changes from 2.3.1 to 2.4.0.
Core Framework
A new feature called "test method display options" is available. This features some built-in transformations of test names automatically, in an attempt to generate more readable test names. This comprises a set of flags that can be enabled for individual transformations. For more information, see the
methodDisplayOptionssection of Configuration Files.Support for reporting tests to VSTS has been added. Like our support for TeamCity and AppVeyor, this is a reporter that is automatically enabled when tests are running inside of VSTS. Documentation on how to enable this (with a sample YAML build definition) will be forthcoming shortly.
Data theories can now pass
DateTime,DateTimeOffset, andGuidvalues as strings, and they will be converted automatically to the matching argument type. This is most useful with[InlineData], which does not allow any of these types natively.Fixture objects (class & collection fixtures) can now accept
IMessageSinkas a constructor argument. This message sink only accepts diagnostic messages (that is,IDiagnosticMessage).The
[Fact]attribute has regainedTimeout. If you attempt to use it while any parallelization is turned on, the behavior is undefined.BUG: Fixed an issue where implicit and explicit conversion operator methods were not always used when converting theory data.
BUG: JSON configuration for
maxParallelThreadsdid not properly support the special values of0and-1.BUG: Fixed an issue with some incorrectly escaped characters when reporting to TeamCity (which caused some test names to get mangled or truncated).
BUG: Fixed an issue where synchronous and asynchronous disposal were running in parallel. The documented behavior is that asynchronous disposal (via
IAsyncLifetime) runs to completion before synchronous disposal (viaIDisposable).BUG: Fixed an issue where a test which returned a non-started
Taskobject would run forever. Now the runner will flag this as an immediate failure.
Assertion Library
Added overloads to
Assert.ContainsandAssert.DoesNotContainfor dictionaries. The expected value for these assertions is the dictionary key.Assert.Containsreturns the value for the given key, when the key is present.Added overload to
Assert.EqualforDateTimecomparison, which accepts aTimeSpanprecision argument.Performance improvement for
Assert.Singleto prevent enumerating the whole container.ThrowsExceptionnow exposes the caught exception asInnerException.BUG: Fixed an issue when
Assert.Allencountered anulldata element.
Console runner
Swapped
-noappdomainfor-appdomains [required|ifavailable|denied], to better align with the values from configuration files. The old switch is still supported, but no longer listed in the help page. The default value isifavailable.Updated
-helpto show that-methodcan take wildcards.The console runner is now compiled for all Desktop CLR versions, from 4.5.2 through 4.7.2. The
xunit.runner.consoleNuGet package includes binaries inside thetoolsfolder. In addition there are new MSBuild properties that are available for projects which reference this package, which point to the new executables:XunitConsole452Path(.NET 4.5.2 AnyCpu)XunitConsole452PathX86(.NET 4.5.2 32-bit)XunitConsole46Path(.NET 4.6 AnyCpu)XunitConsole46PathX86(.NET 4.6 32-bit)XunitConsole461Path(.NET 4.6.1 AnyCpu)XunitConsole461PathX86(.NET 4.6.1 32-bit)XunitConsole462Path(.NET 4.6.2 AnyCpu)XunitConsole462PathX86(.NET 4.6.2 32-bit)XunitConsole47Path(.NET 4.7 AnyCpu)XunitConsole47PathX86(.NET 4.7 32-bit)XunitConsole471Path(.NET 4.7.1 AnyCpu)XunitConsole471PathX86(.NET 4.7.1 32-bit)XunitConsole472Path(.NET 4.7.2 AnyCpu)XunitConsole472PathX86(.NET 4.7.2 32-bit)
A new reporter (
-junit) was added to emit results in the JUnit XML format.Using
-verbosenow shows test starting & finished messages.New option
-nonamespacecan be used to exclude the given namespace.New option
-noclasscan be used to exclude the given class.New option
-nomethodcan be used to exclude the given method.BUG: Fixed an issue where invoking the console runner without arguments could throw an exception rather than showing the help page.
BUG: Fixed a compatibility issue with .NET 4.7.2 to allow portable PDBs.
MSBuild runner
Updated the
AppDomains='value'attribute to accept all the legal values (required,ifavailable, anddenied), to better align with the values from configuration files. This was previously a boolean value, so the old values are still supported (truemaps torequired, andfalsemaps todenied). The default value isifavailable.A new reporter (
JUnit) was added to emit results in the JUnit XML format.Using
Reporter='verbose'now shows test starting & finished messages.BUG: The
FailSkipsattribute was previously not settable. This has been fixed.
Extensibility
- The reflection abstraction for CLR attributes now allows field setters (in addition to property setters) when reflecting on attribute constructor arguments. While there were no attributes in xUnit.net itself that used field setters, this will allow extensibility authors to write custom extension attributes that use fields rather than properties for optional attribute arguments.