Updated November 28 with the release of xUnit.net 1.1.
We've just released xUnit.net version 1.1, and we wanted to take the opportunity to do a little cleanup work (that will have breaking changes).
We've added the following features:
- Support for TeamCity; requires:
- TeamCity v3.1 or later
- Tests linked against xunit.dll v1.1 or later
- xunit.console.exe or xunit.runner.msbuild.dll v1.1 or later
- Higher level version-independent runner APIs (more below).
We also made the following breaking changes from v1.0x:
- Renamed XunitExt namespace to Xunit.Extensions.
- Renamed DLLs:
- xunitext.dll => xunit.extensions.dll
- xunitext.runner.msbuild.dll => xunit.runner.msbuild.dll
- xunitext.runner.jetbrains.dll => xunit.runner.resharper.dll
- xunitext.runner.tdnet.dll => xunit.runner.tdnet.dll
- Dropped the xunitext35.dll project entirely (see more below)
- Added a <start> XML element to the version independent runners (see more below)
TeamCity Support
The console and MSBuild runners will automatically detect when they're running in the context of TeamCity, so no changes are necessary to your automated build files, and you can use the same build targets for interactive use and continuous integration.
Dropped xunitext35.dll
The unit test extension methods for .NET 3.5 have never been a fully planned or developed feature, and as such, we moved them to the Samples project.
The new <start> XML element
The <start> XML element was added to xunit.dll v1.1 for version independent runners to be notified that a test is beginning to run. This should allow runners to show which test is currently running, which can be helpful when diagnosing issues with long-running tests. Version independent runners which are linked against ExecutorWrapper need to be written in such a way to cope with the presence or absence of the <start> element, since the it will only be provided when the tests are linked against xunit.dll v1.1 or later.
Higher level version-independent test runner APIs
One of the things we've had on our list for a while is documenting the XML that's used to communicate between version independent test runners and the xUnit.net execution engine. Today, you can link against xunit.runner.utility.dll and use the ExecutorWrapper class to gain access to these XML-based APIs, but since the XML was undocumented, it is a rarely used API. We have since documented the XML format on the project wiki.
Second, we introduced a higher level abstraction for version independent runner authors, which "cracks" the XML elements and converts them into calls against a new interface named IRunnerLogger. The version independent runner author implements this new interface, and uses the callbacks to the logger to present information to the user about the progress of the test run, as well as allowing the user to cancel the test run.
In the process of fleshing out these new runner APIs, we've converted all our runners (except ReSharper) to use them. Until I can write a blog post specifically designed to assist test runner authors, the best place to start understanding how runners are written is to look at the source code for our MSBuild runner.
It will still be important to understand which XML elements are supported based on which version of xunit.dll the user linked against. For example, if the user is linked against a version of xunit.dll prior to v1.1, the XML will not contain any of the <start> elements (and therefore IRunnerLogger.TestStart will never be called). Authors of version independent runners will need to be able to deal with the variance present between the available versions of xunit.dll. The XML format documentation shows which version of xunit.dll introduced each element and attribute.
We will continue to support the XML-based APIs as well as these newer APIs.