TestDriven.Net 2.24: XCopy Deployable Test Runners

There is a new feature in TestDriven.Net 2.24 (and 3.0 Alpha) that should greatly simplify the deployment and versioning of test runner plug-ins. In previous versions it was important that a compatible test runner plug-in was installed for each test framework you use.

This was manageable if all of your projects used the same version of a test framework – however it could quickly get out of hand if a project referenced a different framework version. Because it isn’t always feasible to upgrade all test projects at the same time, teams could end up trapped using an old version of a test framework or with unit test projects that are difficult to run.

As of TesDriven.Net 2.24, it is now possible to include the test runner alongside its test framework assembly. The advantage of doing this, is your tests can be executed without any installer dependencies! For example, you could use any version of xUnit, MbUnit or NUnit and your teammates would be able to execute the tests without needing to worry about which version of xUnit or Gallio to install!

This feature is enabled using a file with a .tdnet extension, which lives in the same directory as your referenced test framework assembly (e.g. ‘mbunit.dll’, ‘xunit.dll’, ‘nunit.framework.dll’ etc.). If you’re using Gallio 3.1 or xUnit.net 1.5, you will find the required ‘MbUnit.dll.tdnet’ or ‘xunit.dll.tdnet’ file already exists. For earlier versions of Gallio, xUnit or MbUnit – this feature can be enabled by crating a simple XML file.

For example, say you have a test project that uses MbUnit 2. This test framework was released long before .tdnet files existed. To make the MbUnit test runner xcopy deployable, you would need to create a ‘MbUnit.Framework.dll.tdnet’ file and copy the contents of ‘\Program Files\MbUnit\bin’ into version control.

The ‘MbUnit.Framework.dll.tdnet’ looks like this:

<TestRunner>
       <FriendlyName>MbUnit {0}.{1}.{2}</FriendlyName>
       <AssemblyPath>MbUnit.AddIn.dll</AssemblyPath>
       <TypeName>MbUnit.AddIn.MbUnitTestRunner</TypeName>
</TestRunner>

The ‘MbUnit.Framework.dll.tdnet’ file should be placed alongside ‘MbUnit.Framework.dll’, ‘MbUnit.AddIn.dll’ and the rest of MbUnit 2. Once you have referenced the ‘MbUnit.Framework.dll’ assembly in this directory, you can uninstall MbUnit 2 and still use TestDriven.Net to execute your tests!

If you’re using a version of xUnit.net prior to 1.5, the ‘xunit.dll.tdnet’ file would look like this:

<TestRunner>
  <FriendlyName>xUnit.net {0}.{1} build {3}</FriendlyName>
  <AssemblyPath>xunit.runner.tdnet.dll</AssemblyPath>
  <TypeName>Xunit.Runner.TdNet.TdNetRunner</TypeName>
</TestRunner>

If you need help making this work with any other test framework, please let me know and I’d be happy to post the details here.

I hope you enjoy the simplified deployment and versioning of whatever test runner you use!

You can download TestDriven.Net 2.24 & 3.0 Alpha from here.

104 Comments

Comments have been disabled for this content.