Registering MSpec Runners for TestDriven.NET on Windows X64

Please note that this post was migrated to my new blog platform. There may be bad formating, broken links, images, downloads and so on. If you need an item on this page, please contact me and I will do my best to get it from my backups.

~E

EDIT: MSpec v0.3 now supports TestDriven.Net’s v2.24 XCopy Deployable Test Runners.  So this blog post is legacy information at this time. 

td_rocket2[1] Machine.Specifications (MSpec) is my preferred Behavior-Driven Design (BDD) framework for Microsoft.NET.  Aaron Jensen, the author of MSpec, released support for TestDriven.NET, xUnit, nUnit, and Gallio.  And with the latest release of v0.3, it adds official support for ReSharper’s Unit Tests and and Selenium integration testing.  Very cool stuff indeed, and a very active project!

What has bugged me a bit is getting TestDriven.NET to see my MSpec specifications, on my Windows 7 x64 platform.  Aaron so kindly includes a InstallTDNetRunner.bat file to register MSpec with TestDrive.NET; but, it only works on x86 systems.

So why does it not work with x64 systems?  It is because the installer for TestDriven.NET registers the runners in a different registry location.

Windows Vista/7 x64 (64-bit) MSpec runner TestDriven.NET registry file

Below, I have created a bat file you can copy and paste into your own InstallTDNetRunner-x64.bat if you are on Windows x64.  Or, you can download it from here:

/blog/binary/legacy/InstallTDNetRunner-x64.zip



@echo off & if not “%ECHO%”==”” echo %ECHO%

setlocal
set LOCALDIR=%~dp0

echo Windows Registry Editor Version 5.00 > MSpecTDNet.reg
echo [HKEY_CURRENT_USER\Software\MutantDesign\TestDriven.NET\TestRunners\MSpec] >> MSpecTDNet.reg
echo “Application”=”” >> MSpecTDNet.reg
echo “AssemblyPath”=”%LOCALDIR:\=\%Machine.Specifications.TDNetRunner.dll” >> MSpecTDNet.reg
echo “TargetFrameworkAssemblyName”=”Machine.Specifications” >> MSpecTDNet.reg
echo “TypeName”=”Machine.Specifications.TDNetRunner.SpecificationRunner” >> MSpecTDNet.reg
echo @=”5” >> MSpecTDNet.reg
echo. >> MSpecTDNet.reg

echo [HKEY_LOCAL_MACHINE\SOFTWARE\MutantDesign\TestDriven.NET\TestRunners\MSpec] >> MSpecTDNet.reg
echo “Application”=”” >> MSpecTDNet.reg
echo “AssemblyPath”=”%LOCALDIR:\=\%Machine.Specifications.TDNetRunner.dll” >> MSpecTDNet.reg
echo “TargetFrameworkAssemblyName”=”Machine.Specifications” >> MSpecTDNet.reg
echo “TypeName”=”Machine.Specifications.TDNetRunner.SpecificationRunner” >> MSpecTDNet.reg
echo @=”5” >> MSpecTDNet.reg
echo. >> MSpecTDNet.reg

echo [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MutantDesign\TestDriven.NET\TestRunners\MSpec] >> MSpecTDNet.reg
echo “Application”=”” >> MSpecTDNet.reg
echo “AssemblyPath”=”%LOCALDIR:\=\%Machine.Specifications.TDNetRunner.dll” >> MSpecTDNet.reg
echo “TargetFrameworkAssemblyName”=”Machine.Specifications” >> MSpecTDNet.reg
echo “TypeName”=”Machine.Specifications.TDNetRunner.SpecificationRunner” >> MSpecTDNet.reg
echo @=”5” >> MSpecTDNet.reg

regedit MSpecTDNet.reg

del MSpecTDNet.reg


Setup TestDriven.NET and MSpec

Still a bit confused, getting TestDriven.NET and MSpec setup for the first time? Here’s the steps to follow:

  • Go ahead and install TestDriven.NET.  It can be installed and upgraded at any time.
  • Next, grab the latest release of MSpec  and extract the zip to a semi-permanent location.  This is because things such as ReSharper and TestDriven.NET will need to know a common location for the mspec assemblies.  I recommend C:\Program Files (x86)\MSpec.
    • Included with the MSpec zip is an InstallTDNetRunner.bat, but it only works on 32-bit Windows.  For 64-bit Windows, you want to copy my registry code above into a new file called InstallTDNetRunner-x64.bat.
    • Make sure to place this InstallTDNetRunner-x64.bat file in the same directory as your semi-permanent MSpec location above.
  • Finally, you want to double-click and execute the InstallTDNetRunner or InstallTDNetRunner-x64 from within this semi-permanent location.  This will insert the registry values for a new runner called MSpec for TestDriven.NET to detect and execute.

From this point further, you can right-click within different places to execute your specifications within your MSpec.  Some tips on locations you can right-click and execute the specs:

  • The project file: will execute all specs detected within that project.
  • The Namespace: will execute all specs detected within that namespace throughout the project.
  • Within the Establish context or Because of : Will execute all specs within that one class/scenario.
  • Within the It spec - Will execute just that one test.

Something to note is Aaron is currently upgrading MSpec (version 0.4, not released yet) to support TestDriven.NET’s new 2.24 feature of version independent runners. I haven’t looked completely into that myself, but should make registring TDNet runners in the future a bit easier.

> Revision History
> About the author