TestDriven.Net 2.10: Smart BuildThere are a number of new features

January 1, 2009 – 11:00 am

TestDriven.Net 2.10: Smart Build

There are a number of new features in TestDriven.Net 2.10 that I want to highlight (apart from the VS 2008 crash workaround). The one I’m going to focus on here is subtle, but significant I believe - especially for people working with large solutions.

Smart build is a new optimization that allows you to skip the build step before test execution when there are no source code changes. Anyone working on a solution with a large number of projects will know how time consuming the build can be before any tests can be executed. Somewhat surprisingly this remains true even when no actual source code edits have been made and nothing needs to be compiled. I’ve had reports of the build check taking as long as 45 seconds before any tests could be executed! (Thanks to Brian Genisio in particular for bringing this to my attention)

The new smart build feature overcomes this particular problem by monitoring your solution for source code edits and automatically skipping the build step if there is nothing new to compile. This can significantly improve performance when running multiple tests in the same solution. For example there is now no penalty for choosing to execute all tests in a fixture after an individual test starts to pass: a common usage pattern.

I will elaborate further on other new features in future posts. In the meantime you can read the latest release notes and download TestDriven.Net 2.10 from here. If you find any issues, please don’t hesitate to contact me.

TestDriven.Net 2.11: Parameterized NUnit Tests

TestDriven.Net has always supported parameterized test methods when used with the MbUnit testing framework. When using MbUnit, it is common for a single test method to execute multiple tests with different parameter inputs. The most famous of these test types is the MbUnit RowTest.

Until now there has been little reason to add support for executing parameterized tests using NUnit (historically NUnit has only supported parameterless test methods). However Andreas Schlapsi has recently written an implementation of MbUnit’s RowTest using NUnit 2.4’s Addin extensibility mechanism.

I’ve updated TestDriven.Net 2.11 to better support NUnit add-ins and enable the targeting of RowTests and other parameterized test types. This version also includes a workaround for a log4net related issue that was causing a noticeable delay when launching the NUnit 2.4 GUI. You can find the release notes for TestDriven.Net 2.11 here.

To install the RowTest Extension for NUnit you will need to do the following:

  1. Download and install TestDriven.Net 2.11.
  2. Download the RowTest Extension for NUnit 2.4.5 (Binary).
  3. Create a directory called ‘addins’ in ‘%ProgramFiles%\TestDriven.NET 2.0\NUnit\2.4′.
  4. Copy the ‘NUnitExtension.RowTest.AddIn.dll’ file into the ‘addins’ directory (don’t put any non-assembly files there).
  5. Add a reference to ‘NUnitExtension.RowTest.dll’ from your NUnit test project.

 RunRowTest

You can then start writing and executing MbUnit style RowTests inside your NUnit projects! You can find Peli’s original RowTest example here.

TestWithNUnit24

To view your RowTests inside the NUnit GUI you will need to use ‘Test With > NUnit 2.4′. You will find this option on the ‘Solution Explorer’ project context menu.

NUnitGui

Thanks to Wayne Brantley for letting me know about the RowTest Extension for NUnit.

The Morning Brew #253 Software Database Comparator - Amir Mehrabi

January 1, 2009 – 5:00 am

The Morning Brew #253
Software Database Comparator - Amir Mehrabi J shares a tool he created for comparing SQL Server database structures Information Discussion: OO 101 Solutions and the Open Close Principle at the architecture level - Ayende posts up a (slightly) edited transcript of a conversation he had with Luke Breuer about making software better and following on from his post […]

Canon EOS 300D One of my Christmas presents was a

December 31, 2008 – 11:00 pm

Canon EOS 300D
One of my Christmas presents was a “new” camera - a Canon EOS 300D.

Christmas: Royal Institution Christmas Lectures and Many-Core
I’ve always been a big fan of the Royal Institution Christmas Lectures and I was surprised to see that this year they were being given by Microsoft’s own Chris Bishop; I’ve been recording them on the Media Centre and, so far, I’ve only seen the first one which was about the push for computing speed. The audience looked to be approximately 10 years old or so and by the end of the first lecture Chris had got to the point where he’d explained why Moore’s Law wasn’t going to really hold for single

Ebooks
Hi all. I need Professional Search Engine Optimization with ASP.NET: A Developer’s Guide to SEO book may you sent it for me? thanks SNIP

Can Windows 7 Save Microsoft From Itself?
I think we can safely say that Windows Vista was a flop. The only one that doesn’t seem to know it is Microsoft. Or does it? This week at WinHEC, the company introduced a series of capabilities in Windows 7 that it says will “make it easier for hardware partners to create new experiences for Windows PC customers.” The move is intended to “rally hardware engineers to begin development and testing” for its nascent operating system. According to a recent report on downloadsquad.com, Windows 7 could be available as soon as soon as the middle of next year, but Microsoft’s original promise in 2007…

Fedora 10 is a 10 Fedora releases usually generate more

December 31, 2008 – 6:00 pm

Fedora 10 is a 10
Fedora releases usually generate more yawns than a Ben Affleck movie for me but this time, they’ve gone the extra mile. I placed Fedora at number 7 in my 10 Best Linux Distributions post but now that I’ve seen Fedora 10, I may have to reorder the list and place Fedora at number 5 or 6. Is this release really that good? Yes, it is. With an improved boot process, much needed printing enhancements, and built-in virtualization; Fedora 10 is worth a serious look. Its full list of new and improved features are: 1) Faster Boot Process 2) New Artwork and Themes 3) Faster and Better Printing

Will Open-Sourcing Java Remove Competitive Corporate-Think?
Publicly-held corporations ostensibly serve the people they sell products to, but are required by law to actually serve their shareholders. Privately-held companies only serve the customer.

Advanced LDAP In this article, Debjani discusses how to manipulate

December 31, 2008 – 10:00 am

Advanced LDAP
In this article, Debjani discusses how to manipulate LDAP directories such as adding, updating and deleting entries and some other advanced topics related to LDAP. In addition to this, she also examines how to add and delete attributes to an entry. Towards the end of the article she also examines how to manage LDAP Security with special reference to Application Security.
Debjani Mallick

Obama’s Plans For Infrastructure Mean New Tech Jobs
No matter which political camp in which you choose to pitch your tent, it’s hard to deny that technology is at the heart of President-Elect Barack Obama new plans for the United States. As we learn more about what ideas he has in mind to strengthen the economy and gird the country’s existing infrastructure, it’s plain to see that new jobs in the tech sector will be created along the way. In a discussion of his economic agenda over the weekend, Obama pledged to put computers in classrooms, make broadband access more readily available, and also make electronic medical records a reality….

file upload
Hi I am trying to upload an excel file to the server. But it won’t work, every time I am trying to upload an xls file and press the button. it writes: No file was uploaded. as if i had no file. you are welcome to try on: http://radio.web.surftown.dk/admin/indset_program.aspx the top section where…

TestDriven.Net Options Pane

options

In the latest version of TestDriven.Net you will find a new options pane. The options are as follows:

Hide trace/debug output when running all tests in project/solution

In the past this setting has always been hardwired to true. It means you can add trace information to a test without cluttering up the Test output pane when all tests are executed. An alternative way to ensure a message will always appear in the output is to use Console.WriteLine rather than Trace.WriteLine . This also means the verbose Gallio/MbUnit test run output will show up when executing all tests in a project.

Cache test process between test runs

By default the external test process will be cached when the Run Test(s) command is used. This process appears in the tool tray as a rocket icon which can be used to kill the process. This is fine unless one of your tests starts leaking leaking native resources (such as leaving open a file handle). The best solution is to fix the resource leak, but you now have to option to work around the issue by killing the test process at the end of each test run. This can be useful if the resource leak is in a 3rd party DLL which can t be easily be changed.

Categories

This option supports the most common use of test categories; you can choose to include or exclude a selection of categories. This is useful if you want to exclude long running tests or if your machine isn t configured to execute integration tests. This feature is currently only supported by the NUnit runner that comes with TestDriven.Net, but I believe it will be supported by a a future version of Gallio.

You can specify your NUnit test categories like this:

    [Test, Category("LongRunning")] 
    public void LongRunning() 
    { 
        Thread.Sleep(10000); 
    } 

There are lots of features in TestDriven.Net that could be exposed as options. I ll try to resist this temptation as much as possible, but I m sure a few more will creep in. ;-)

Book Review: 70-502 Training Kit by MS Press This is

December 31, 2008 – 3:00 am

Book Review: 70-502 Training Kit by MS Press
This is a book review on MCTS Self-Paced Training Kit (Exam 70-502: Microsoft .NET Framework 3.5 Windows Presentation Foundation. The author reveals the information set out in each chapter and how using this book will help prepare the reader for the test required to obtain the MCTS certification on WPF.
Andrea Colaci

Creating a Wireless Access Point using DD-WRT
This post is a reminder to myself in case I ever need to troubleshoot this setup process again, but I thought I would post it just in case it is useful to somebody else. A couple days ago I ordered myself a Linksys WRT150N to replace my aging Linksys WRT54G wireless router. I wanted to update […]

Fedora 10 is a 10
Fedora releases usually generate more yawns than a Ben Affleck movie for me but this time, they’ve gone the extra mile. I placed Fedora at number 7 in my 10 Best Linux Distributions post but now that I’ve seen Fedora 10, I may have to reorder the list and place Fedora at number 5 or 6. Is this release really that good? Yes, it is. With an improved boot process, much needed printing enhancements, and built-in virtualization; Fedora 10 is worth a serious look. Its full list of new and improved features are: 1) Faster Boot Process 2) New Artwork and Themes 3) Faster and Better Printing

Hello, F#!  This is a quick post to break my

December 30, 2008 – 8:00 pm

Hello, F#!

hellofs 

This is a quick post to break my writers block.

download

Free CodeRush ( and bits of Refactor Pro ) Xpress

December 30, 2008 – 2:00 pm

Free CodeRush ( and bits of Refactor Pro ) Xpress for C#
One of the great announcements at the PDC was that Microsoft and DevExpress have done a deal to giveaway a version of CodeRush which includes some of the more popular features of CodeRush and Refactor Pro For those of you lucky enough to come to our evening event with the legendary Oliver Sturm, you will have already got it or its fully featured versions. I would not endorse this product if I really didn?t believe in it. To answer someone’s question at our event, every developer at Bla

Infrastructure Appreciation for Developers.
Hardware and Software are very much the modern day Yin and Yang, one serves little purpose without the other. I have noticed that on the whole many developers know little about the environments that the software they are writing is going to work in falsely believing they are truly abstracted from it . Come ‘Go Live’ there are blank faces when for some ‘inexplicably reason’ the software doesn’t work and the remark, ‘it worked fine in test’ is often heard. Another common frustration is software t

Improved support for MbUnit, xUnit and GallioThe main focus of

December 30, 2008 – 7:00 am

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!

SQLBits - Introduction to XML, Performance Tuning SQL and SQL Injection
I’ve submitted a couple of sessions for SQLBits IV You can see the sessions that have been submitted so far by going here -Submitted Sessions -

TestDriven.Net 2.13: Support for Silverlight 2.0 Beta 1

I’ve just uploaded a new version of TestDriven.Net with support for Silverlight 2.0 Beta 1. Microsoft have certainly kept me on my toes as there have been lots of changes since Silverlight 1.1. I’m sorry it has taken a while!

At the moment you’re limited to running individual public methods (ad-hoc tests). If you need to run a suite of tests I recommend you use this in conjunction with the Silverlight Testing Framework that was released at MIX. Jeff Wilcox has posted a detailed tutorial that shows how to use the framework here. When running your tests using ‘Test With > Silverlight’, bear in mind that you’re simply executing the test method and any test attributes (TestInitialize etc.) will be ignored.

TestWithSilverlight2

I’ve also included an application called ‘agx.exe’ that lets you run console applications using the Silverlight/CoreCLR from the command line. After you’ve installed TestDriven.Net you will find this standalone application here: \Program Files\TestDriven.NET 2.0\agx.exe. This is simply an application that I use for my own testing purposes that I thought other people might find useful.

ConsoleSilverlight2

You can download the new version of TestDriven.Net from here.

Merry Christmas Today is Christmas day and I?m away from

December 30, 2008 – 1:00 am

Merry Christmas
Today is Christmas day and I?m away from the computer, enjoying Christmas dinner with my wife and daughter ? I?m off the grid! As is our tradition, we?ll start with a nice bottle of Champagne and some smoked salmon. Then a bottle of Opus 1, with some cold roast duck, along with roasted turkey and roasted boneless chicken. We?ll finish up with some pudding and a nice bottle of vintage port. If anyone?s in the area and is not driving, they would be most welcome ? I?d be happy to open up another bo

Azure Storage + Session Affinity
This came into my head last night when uploading a couple of blobs into the cloud. Since I developed my blob browser, I’ve found myself using it to transfer files from one machine to another. For the sake of efficiency I found myself with one remote desktop connection to one machine, and me being on my main machine. Since this was an update to an existing file that I was transferring, I copied over the existing zip file in the cloud. I was being particularly lazy, and I just used a public uri

TestDriven.NET 2.18 + NUnit 2.5 Beta

I ve just uploaded a new version of TestDriven.Net with support for NUnit 2.5 Beta.

There s a menagerie of weird and wonderful new attributes to choose from in this point release of NUnit. Ben Hall has written a good summary of the Alpha version and I m sure Charlie Poole will be blogging about the Beta in the coming days.

Here s a quick summary of a few new attributes:

Generic test fixtures can be used when you need to run a batch of tests against few different implementations of a type. In the past something similar could be achieved by having an abstract base fixture and extending it for each implementation you needed to test. By using a generic fixture you keep all your test code in a single class and I think it s more expressive.

    [TestFixture(typeof(ArrayList))] 
    [TestFixture(typeof(List<int>))] 
    public class IListTests<TList> where TList : IList, new() 
    { 
        [Test] 
        public void Count() 
        { 
            IList list = new TList { 1, 2, 3 }; 
            Assert.AreEqual(3, list.Count); 
        } 
    }

The TestCase attribute is similar to MbUnit s RowTest . With this attribute you transform a single test method into multiple test cases. You can also define an expected return result, but I d advise against using this if you want a stack trace when your test fails. It s better to explicitly define the assert inside the test method.

    public class TestCases 
    { 
        [TestCase(4, 2, 2)] 
        [TestCase(2, 1, 1)] 
        [TestCase(5, 2, 3)] 
        public void Add(int answer, int a, int b) 
        { 
            Assert.AreEqual(answer, a + b); 
        } 
    } 

In previous versions of NUnit you could specify which threading model your tests required by adding some XML to your test project s App.config file. You can now specify this directly on the test that needs it using the RequiresMTA/STA attributes.

    [Test, RequiresMTA] 
    public void MTA() 
    { 
        Assert.AreEqual(ApartmentState.MTA, 
            Thread.CurrentThread.ApartmentState); 
    } 
    [Test, RequiresSTA] 
    public void STA() 
    { 
        Assert.AreEqual(ApartmentState.STA, 
            Thread.CurrentThread.ApartmentState); 
    } 

Lastly the TestFixture attribute is no longer required and test methods are allowed to be static. This means NUnit can now be used in a natural way for testing F# code. Note, you will need to have "Other Flags" set to "–optimize+ notailcalls" in your project s build properties if you want to see a stack trace on any failed asserts.

    #light 
    open NUnit.Framework 
    [<Test>] 
    let fsharp() =  
        Assert.AreEqual(2 + 2, 4) 

Update: I ve tried to highlight a few features in NUnit 2.5 which can be used to make your unit tests clearer. Xerxes Battiwalla has written a post about Assert.Throws<T>() which also falls into this category.

    [Test] 
    public void CreateDomain_Null() 
    { 
        Assert.Throws<ArgumentNullException>(() => AppDomain.CreateDomain(null)); 
    }

For more information see the TestDriven.Net 2.18 release notes and the NUnit 2.5 documentation.

Creating a Wireless Access Point using DD-WRT
This post is a reminder to myself in case I ever need to troubleshoot this setup process again, but I thought I would post it just in case it is useful to somebody else. A couple days ago I ordered myself a Linksys WRT150N to replace my aging Linksys WRT54G wireless router. I wanted to update […]

Automating Software Development Processes By Tim Kitchens
Automating repetitive procedures can provide real value to software development projects. In this article, we will explore the value of and barriers to automation and provide some guidance for automating aspects of the development process.
Click here for the full article.