Core Framework v2 2.1.0 2015 September 27
Today, we're shipping two new releases:
- xUnit.net Core Framework v2
2.1.0
- xUnit.net Visual Studio adapter 2.1.0
It's been 6 months since the release of 2.0.0
. Since that release was a ground-up rewrite, we spent the intervening time listening to developer feedback, improving the core framework as well as adding features that we weren't able to get into 2.0.
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.0.0
to 2.1.0
.
Core Framework
Added support for ASP.NET 5.
Added support for Universal Windows Applications.
A configuration feature (via
App.config
) was part of the 2.0 release, but only available to desktop unit tests. Configuration in 2.1 now includes JSON support, and is available on all platforms (assuming that the runner correctly reads and obeys the configuration file, of course). For more information, see Configuration Files.Added a new
IAsyncLifetime
interface, which can be implemented by test classes and fixture classes to get asynchronous lifetime support (creation and disposal). This should make writing asynchronous setup and teardown code much simpler, because developers can use theasync
keyword.Class fixture classes can now use constructor injection to get access to collection fixtures.
The
[ClassData]
attribute has be brought back.Attributes which derive from
BeforeAfterTestAttribute
can now be decorated onto test collection definition classes, and will be run for all tests in the test collection.Removed support for Windows 8 applications.
Display of generics in theory test names was dramatically improved.
Added support for unsigned types in serialization.
Added test case output support for TeamCity.
Improved performance when running with many rows of theory data.
BUG: xUnit.net v1 support was inconsistent about sending ClassFinished and CollectionFinished messages.
BUG: Fixed an issue where arrays of types other than object were causing serialization issues.
BUG: Fixed an issue with XML output where illegal characters were trying to be written.
BUG: Fixed an issue with Mono where some ASP.NET v5 tests would lose access to ambient runtime values.
BUG: Fixed an issue with Xamarin device runner projects where
xunit.execution.{platform}
was not being linked into the project.BUG: Fixed several issues with data types not working correctly in data theories.
BUG: Fixed an issue with device runners where it would fail to run tests because it could not find the unit test assembly.
BUG: The serialization system could not correct roundtrip
float.MinValue
,float.MaxValue
,double.MinValue
ordouble.MaxValue
. This primarily affect theories using these values, when run in Visual Studio.BUG: Environmentally enabled reporters (like TeamCity and AppVeyor) should override explicitly chosen reporters.
BUG: xUnit.net was unable to load signed test assemblies.
BUG: The 'unlimited' thread option wasn't working correctly (it was incorrectly limiting the active threads).
BUG: The
<collection>
elements were not correctly generated in the XML output (tests were not always grouped into the correct collection).BUG: Using a
Task
in theory data might cause the discoverer to hang while it attempted to create a string representation of the task.BUG: There was an issue ordering test cases when running on UWP. Now, test cases are always randomized (with no attempt at stability) for tests running on UWP.
BUG: Some theories passing
Type
objects from types in the GAC could cause the Visual Studio runner to fail.BUG: There was an error in the implementation of worker threads that could cause unexpected failures of the test platform itself.
BUG: Fixed an issue with
AsyncTestSyncContext
throwing exceptions with the Devices Runner.BUG: Changed the way test assemblies are loaded on the desktop, which should fix some usage of "no app domain" mode.
Console Runner
Added a new
-nocolor
option.Added a new
-verbose
option.Added a
-failskips
switch which turns skipped tests into failures.Added a
-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 theFoo
namespace, plus tests in all the child namespaces ofFoo
(likeFoo.Bar
orFoo.Bar.Baz
).BUG: Fixed an issue where some exceptions without stack traces were causing runner failures.
MSBuild Runner
Added support for reporting tests to AppVeyor. This is normally automatically detected during execution, but can be forced with
Reporter="appveyor"
.Turned off pre-enumeration of theories to improve performance.
Added a new
NoColor
option.Added a new
NUnit
option to transform results into NUnit format.Deprecated
TeamCity="true"
in favor ofReporter="teamcity"
.Deprecated
Verbose="true"
in favor ofReporter="verbose"
.Added a
FailSkips="true"
attribute which turns skipped tests into failures.
Runners
Runners which will immediately execute tests (like the console and MSBuild runners) no longer pre-enumerate theory data, to help improve discovery performance and reduce memory usage.
Added support for desktop projects to run without app domains (in the console and MSBuild runners). This substantially improves startup and execution performance, at the cost of isolation.
Runner Utility
A new extensibility feature was added to the text-based runners (console, MSBuild, and DNX) which allows developers to completely control the output from the runner. This feature—runner reporters—is how support for TeamCity and AppVeyor is implemented now.
A new
AssemblyRunner
class was added to the runner utility libraries, that makes it substantially simpler for users who want to leverage xUnit.net to do non-testing activities (for example, to write a Best Practices Analyzer). Sample code: https://github.com/xunit/samples.xunit/blob/main/v2/TestRunner/Program.csThe runner utility libraries (
xunit.runner.utility.*.dll
) were also reduced down to two:xunit.runner.utility.desktop.dll
(which can run all tests) andxunit.runner.utility.dotnet.dll
(which can run tests linked againxunit.execution.dotnet.dll
). Since the runner libraries are intended to be backward compatible, they can run tests written against xUnit.net 1.9.2 and 2.0.
Extensibility
The execution libraries (
xunit.execution.*.dll
) that shipped in 2.0 were consolidated down into two:xunit.execution.desktop.dll
(for desktop usage, including AppDomain support) andxunit.execution.dotnet.dll
(for all other usage, including DNX, Windows, Windows Phone, Android, and iOS). By reducing the execution library count from 7 to 2, it makes it simpler for developers to provide extensions to the testing framework.TestInvoker.InvokeTestMethodAsync
was accidentally made public just before the 2.0 release. It has been restored back to protected, as was originally intended.TestCollection.Serialize
andTestCollection.Deserialize
has been made virtual, so developers can re-use the implementation while enhancing the serialization behavior.Runner authors can now opt out of using app domains when running on the desktop CLR. The flag is passed to
XunitFrontController
,Xunit1
,Xunit2
, andXunit2Discoverer
. This is a breaking API change, so that authors will be aware of the impact of this potential change.The discovery systems in
FactAttributeDiscoverer
andTheoryAttributeDiscoverer
have been enhanced.Added
ITestFrameworkExecutionStarting
andITestFrameworkExecutionFinished
messages for runner reporters.Added
TestInvoker.CallTestMethod
as an extensibility point.Added a new
TraitHelper
class toxunit.extensibility.exection
to make it easier to determine the traits that are decorated on a test method.BUG:
TestInvoker
would invoke unit tests even if the user had requested cancellation. This has been fixed.BUG: Fixed a bug where types which implemented
IXunitSerializable
but did not actually serialize anything were not working.