Core Framework v2 2.2.0 2017 February 19
Today, we're shipping three new releases:
- xUnit.net Core Framework v2
2.2.0
- xUnit.net Visual Studio adapter 2.2.0
It's been 17 months since the release of 2.1.0. The delay of the final release of 2.2 had been pushed back to align roughly with the release of .NET Core 1.0. While that was released back in June of last year, the pieces we relied upon (namely, the .NET CLI SDK) have remained in pre-release; their RTM is just a couple weeks away with the shipping of Visual Studio 2017.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Important
If you are using Visual Studio 2013, you must use NuGet 2.12 or later to use xUnit.net 2.2, because support for netstandard
is required. You will not be able to use xUnit.net 2.2 with Visual Studio 2012 (if Visual Studio 2012 support is important, please stick with xUnit.net 2.1).
Release Notes
These release notes are a comprehensive list of changes from 2.1.0
to 2.2.0
.
General
The minimum version of .NET required for desktop CLR unit tests is now .NET 4.5.2. This change was made since both 4.5 and 4.5.1 are now out of official support. This change only affects your unit test projects; your production code is still free to target lower versions of .NET. (Note: Because we support
netstandard1.1
, you will still be able to link your desktop unit test projects that target 4.5 and 4.5.1, but they will not show up in the Visual Studio runner, and they will not get desktop features like AppDomain isolation. Make sure you upgrade the .NET version of your projects before installing the new NuGet packages.)We have removed support for Windows 8.x Store applications, as well as Windows Phone 8.x applications. We continue to support Universal Windows applications (from Windows 10 RTM forward). The removal of this support also affects the Visual Studio runner. For users who continue to need to target these outdated platforms, they should stick with version 2.1 of both xUnit.net and the Visual Studio runner.
Core Framework
Added
Skip
property to theory data attributes.Added support for trait attributes at the assembly level.
Updated
NUnitXml.xslt
to be compatible with NUnit 2.5 output.We have enabled support for detecting when tests may be running too long. This feature is turned off by default, but can be enabled in your configuration file.
Added support for .NET Core 1.0 RTM.
Added support for the new
netstandard
target frameworks. To use these new NuGet packages, you will need NuGet 3.4+ (for VS2015) or NuGet 2.12+ (for VS2012 and VS2013).Test discovery and execution performance has been dramatically improved when app domains are being used (the default behavior). This performance improvement requires runner changes; the shipped runners (Console, MSBuild, TestDriven.Net, and Visual Studio) have all been updated.
Support for detecting hung unit tests has been added. It is a configuration option which can be enabled in your configuration file.
Support for F# async tests was added. For an example of how to write an F# async test, please see our acceptance test for this feature.
Performance of the AppVeyor runner reporter was improved.
Added support to
[MemberData]
to allow it to use members from derived types.Dramatically improved support for generics in test methods (for complete coverage, see the unit tests).
Added support for theory methods with optional parameters.
Added support for theory methods with params arrays.
Added support for inherited traits attributes on test classes.
Added support for serializing multi-dimensional arrays in theory data.
Added a completion timestamp to xUnit v2 XML, and the HTML report.
Added a guard against theory data enumerators throwing.
Added a guard against theory data providers returning
null
.BUG: Fixed an issue where PCL unit tests were run in desktop mode instead of PCL mode, which caused issues when linking against PCL-based extensibility libraries.
BUG: Fixed an issue when running unit tests from UNC paths (not mapped to a drive letter).
BUG:
ArgumentFormatter
was causing a null reference exception when attempting to format an unbound generic type.BUG: Fixed an issue where trying to perform multiple XML transformations at the same time caused a file sharing violation.
BUG: Improved reliability when reporting to AppVeyor with a longer timeout.
BUG: Fixed an issue where async fixtures could end up being initialized multiple times.
BUG: The automatic environmental support for the AppVeyor and TeamCity runner reporters was incorrectly triggering if the environment variable was present (but empty).
BUG: Fixed an issue with serializing negative zero floats/doubles.
BUG: Fixed a bug with invalid characters written to
ITestOutputHelper
.
Assertion Library
Added event assertions:
Assert.Raises
Assert.RaisesAsync
Assert.RaisesAny
Assert.RaisesAnyAsync
Assertion is done with three lambdas:
- A subscription lambda (i.e.,
handler => myClass.MyEvent += handler
) - An unsubscription lambda (i.e.,
handler => myClass.MyEvent -= handler
) - An action which causes the event to be raised
For examples, see the unit tests.
Added
Assert.PropertyChangedAsync
.Added support for sets to
Assert.Equal
.Added support for using NuGet v3 to pull in Assert as source.
xunit.assert.source
is now correctly marked as a development-time dependency in the NuGet package.Assert.All
now includes the faulty item in the failure message.Improve compatibility of
Assert.Equal
when given two equivalent collections that are different types (f.e.,string[]
andList<string>
).Added a guard against
IEnumerable
implementations throwing.Added support for
IStructuralEquatable
toAssert.Equal
Improved
Assert.Collection
to include the collection when reporting assertion failures.Improved handling of multi-rank arrays so that
[1,2]
and[[1],[2]]
no longer incorrectly show as equal.Improved handling of
ISet
implementations which are either not generic, or have more generic parameters than just the item type.We are now disposing enumerators in
Assert.Empty
andAssert.NotEmpty
.
Console Runner
Added a new JSON reporter with the
-json
switch.Made console runner exit codes consistent and predictable.
Ensured
xunit.runner.console
NuGet package is marked withdevelopmentDependency=true
.Improved console runner error message when an unknown switch is passed.
A new
-noautoreporters
switch was added to disable any automatic environmentally enabled runner reporters (for example, AppVeyor or TeamCity).Added wildcard support (
*
and?
) in the-method
command line option.
MSBuild Runner
Added
IgnoreFailures
option, which allows the task to return a success exit code even when one or more tests have failed.Added a new JSON reporter with the
json
reporter type.Ensured
xunit.runner.msbuild
NuGet package is marked withdevelopmentDependency=true
.A new
NoAutoReporters
property was added to disable any automatic environmentally enabled runner reporters (for example, AppVeyor or TeamCity).The deprecation properties
TeamCity
andVerbose
were officially removed. TheReporter
property (with a value ofteamcity
orverbose
) should be used instead.
Extensibility
Added additional diagnostic messages to
TheoryDiscoverer
.Moved
IExecutionVisitor
andXmlAggregateVisitor
intoxunit.runner.utility
; if you were previously hand-copying these files into your runner, you can remove your copy now in favor of the one that ships in the runner DLL.A new interface
IMessageSinkWithTypes
was added as part of the work to dramatically improve the discovery and execution performance of v2 unit tests. Runners which have custom message sinks should implement this new interface rather than the olderIMessageSink
interface. Most of the methods in the system have been updated (or extended) to accept both interface types. When that wasn't possible, two classes were added that can wrap implementations of one into the other (for more information, seeMessageSinkAdapter.Wrap
andMessageSinkWithTypesAdapter.Wrap
).The visitor classes (based on
IMessageSink
) have been deprecated due to their poor performance. New event-based sink classes (based onIMessageSinkWithTypes
) have replaced them. The new sink classes use events that can be subscribed to; these replace the old virtual methods in the visitor classes. The new sink classes have a significantly improved class hiearchy.Runner reporter authors should return message hanlders that implement both
IMessageSink
andIMessageSinkWithTypes
for best compatibility and performance. TheDefaultRunnerReporter
andDefaultRunnerReporterMessageHandler
base classes has been deprecated, and replaced withDefaultRunnerReporterWithTypes
andDefaultRunnerReporterWithTypesMessageHandler
, which implement the new high-performance message sink interface.TestDiscoverySink
now includes the ability to cancel test discovery;TestDiscoveryVisitor
did not include this ability.There is a slight breaking contract with
XunitFilters
whereinIncludedMethods
was changed from exposed asHashSet<string>
toICollection<string>
, in order to better support the new wildcard method feature. Hopefully this will have minimal impact on runner authors.BUG: Fixed an issue with null refs happening in
TestRunner.cs
.