Learning through frustration If this morning was any indication, today

August 29, 2009 – 11:00 am

Learning through frustration
If this morning was any indication, today threatened to thunder uncontrollably down hill into what all you cool internet types would recognise as a Big Fat ber-Fail! Having this week purchased additional gear to make the most of drawing and sketching on-site (as opposed to snapping photographs and sketches then working purely in my ?studio?), I […]

Improved support for MbUnit, xUnit and Gallio

The main focus of the TestDriven.Net 2.18 release has been to improve support for test runner plug-ins in general (not just NUnit). If you re using xUnit, MbUnit or Gallio I recommend you upgrade to this version.

Automatic support for 64-bit machines

The registry layout on 64-bit machines is plain weird and full of pitfalls for the unwary. The registry layout is different depending on whether you re installing under HKLM or HKCU. Under HKLM the SOFTWARE key is split and test runner plug-ins needed to be registered twice in order to work in both 32 and 64-bit processes. There is no such split under HKCU and plug-ins installed there only needed to be registered once.

This created the unfortunate situation where plug-ins installed for all users wouldn t work when running in a 64-bit process, but plug-ins installed just for me would work fine. Rather than expect plug-in developers to deal with this weirdness, I ve made some changes to automatically support plug-ins that aren t 64-bit aware.

If you have an assembly that needs to work on 32 and 64-bit machines, you may find the following snippet useful:

    public static RegistryKey OpenSoftwareKey(bool hklm, string name) 
    { 
        string fullName = @"SOFTWARE"; 
        if (hklm) 
        { 
            if (Marshal.SizeOf(typeof(IntPtr)) == 8) 
            { 
                fullName += @"\Wow6432Node"; 
            } 
            return Registry.LocalMachine.OpenSubKey(fullName + @"\" + name); 
        } 

        return Registry.CurrentUser.OpenSubKey(fullName + @"\" + name); 
    } 

The following ad-hoc test will display TestDriven.Net s install directory (assuming TestDriven.Net is installed for all users ):

    void test() 
    { 
        using(var key = OpenSoftwareKey(true, @"MutantDesign\TestDriven.NET")) 
        { 
            Console.WriteLine(key.GetValue("InstallDir")); 
        } 
    }

Better support for ah-hoc tests

In previous versions of TestDriven.Net, a test runner plug-in was required to explicitly signal when none of its tests were found for execution. This would give other test runners (such as the ad-hoc test runner) a chance to handle the test. Unfortunately most test runners have been signaling a successful test run when tests were found but none were targeted.

I ve changed it so the ad-hoc test runner will automatically get a chance to execute if no tests were executed and the test runner plug-in indicated a successful test run. The upshot of this is that you can now have ad-hoc side-by-side with MbUnit or xUnit tests.

If you re using xUnit, try doing Run Test(s) on each of the following methods:

    [Fact] 
    public void TestMe() 
    { 
        Console.WriteLine("Console output isn’t displayed when using xUnit"); 
        Assert.True(false, "Comment out [Fact] and run as ad-hoc test! ;) "); 
    } 

    void hello() 
    { 
        Trace.WriteLine("Hello, World!"); 
    } 

    void dump() 
    { 
        Trace.WriteLine(AppDomain.CurrentDomain, "_verbose"); 
    }

(ad-hoc tests should work side-by-side with all other test framework methods as well)

Improved performance when executing with Gallio / MbUnit v3

Gallio is a test runner that supports many different test types (MbUnit, xUnit, NUnit, MSTest and more). It has its own plug-in architecture and it doesn t use the default TestDriven.Net app domain test isolation. This makes Gallio very flexible, but it also meant it wasn t appropriate to setup and tear down the Gallio engine for each test run.

I ve made some changes to allow Gallio to stay resident in the test process. This has significantly improved performance (especially for short test runs). If you re using Gallio/MbUnit v3, try upgrading to Gallio v3.0.5 build 546 and see how much of a different it makes.

Feedback

There have been lots of other changes which you can find in the release notes. If you notice any new issues, please don t hesitate to let me know!

TestDriven.Net 2.20: Improved NCover Integration

In the latest release of TestDriven.Net, you ll find much improved integration with all versions of NCover:

Support for 64-bit Windows

Test With > Coverage now works on 64-bit versions of Windows. In previous versions this could be made to work by compiling your test project for x86. The new version will automatically execute your tests in a 32-bit process if a 64-bit version of NCover can t be found. (There is similar 64-bit Windows support for dotTrace and Team Coverage)

No more Reload coverage file? dialog

NCoverExplorer 2.1 & 3.0 will no longer prompt to reload the coverage file. The coverage report will automatically refresh when new data is available. If you re using NCover 3.0.18 or higher, you won t be prompted to save a New Project when you close NCoverExplorer.

Automatic assembly filtering

If you re using NCover 3.0, only assemblies that have a corresponding PDB file will appear in the Explorer window. I m hoping this is a good alternative to explicitly naming assemblies that shouldn t appear in the coverage support.

Support for Typemock Isolator

You can now execute Test With > Coverage with NCover 3.0 and Typemock Isolator installed. (Previous versions would fail with the error: Couldn’t find TypeMock profiler name for NCover 3.0 .)

Recommended Versions of NCover & Typemock

If you have a commercial license for NCover, make sure you re using NCover 3.0.18 or later. If you re using Typemock Isolator, I recommend you use at least version 5.3.0.

 

If you d like more timely updates on new releases, you can find me on twitter here.

Which test runner are you using ?

Fabio Maulo is doing a poll to find out which test runners people are using:

poll

You can take the poll and see the results here.

You must be logged in to post a comment.