Table of Contents

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 methodDisplayOptions section 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, and Guid values 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 IMessageSink as a constructor argument. This message sink only accepts diagnostic messages (that is, IDiagnosticMessage).

  • The [Fact] attribute has regained Timeout. 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 maxParallelThreads did not properly support the special values of 0 and -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 (via IDisposable).

  • BUG: Fixed an issue where a test which returned a non-started Task object would run forever. Now the runner will flag this as an immediate failure.

Assertion Library

  • Added overloads to Assert.Contains and Assert.DoesNotContain for dictionaries. The expected value for these assertions is the dictionary key. Assert.Contains returns the value for the given key, when the key is present.

  • Added overload to Assert.Equal for DateTime comparison, which accepts a TimeSpan precision argument.

  • Performance improvement for Assert.Single to prevent enumerating the whole container.

  • ThrowsException now exposes the caught exception as InnerException.

  • BUG: Fixed an issue when Assert.All encountered a null data element.

Console runner

  • Swapped -noappdomain for -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 is ifavailable.

  • Updated -help to show that -method can take wildcards.

  • The console runner is now compiled for all Desktop CLR versions, from 4.5.2 through 4.7.2. The xunit.runner.console NuGet package includes binaries inside the tools folder. 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 -verbose now shows test starting & finished messages.

  • New option -nonamespace can be used to exclude the given namespace.

  • New option -noclass can be used to exclude the given class.

  • New option -nomethod can 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, and denied), to better align with the values from configuration files. This was previously a boolean value, so the old values are still supported (true maps to required, and false maps to denied). The default value is ifavailable.

  • 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 FailSkips attribute 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.