Tuesday, November 16, 2004 - Posts

How about weekly builds of Whidbey and Orcas?

Towards the end of the Java ”Tiger” (J2SE 5.0) project, a snapshot of the binaries was released every week. This enabled early adopters to have access to all the latest bug fixes and changes. The Java community was so enthusiastic about this, that Sun now has decided to release weekly snapshot of not only the binaries, but also the source code for Java “Mustang”. Wouldn’t it be cool if Microsoft did something similar? What some of the bugs in Whidbey went away each week? And wouldn’t it be great to get a flying start on developing with Orcas immediately after .NET 2.0 is released next year?

(Yes, I know that Longhorn previews where handed out at PDC, but I’m thinking of publicly available releases. Not just for the few at PDC or the elite who are “down” with the dudes at Microsoft.)

Running NUnitASP tests in Test Driven .NET

When it comes to unit testing, Test Driven .NET and NUnit is a killer combination. Once in a while I’ve also used NUnitASP to automate dead-boring point, click and type testing of web pages. NUnitASP is a NUnit extension, so it integrates perfectly with the NUnit GUI or Test Driven .NET – at least it used to do that. After upgrading from NUnit 1.11 to the superior 2.2 release NUnitASP tests ran in the NUnit test runner, but I was left with an ApplicationException telling me that the type declaring the test could not be found when running them in Test Driven .NET.
Since the 2.2 release of NUnit has a more of a dotnetty feel to it than its predecessors, having to revert to an earlier version was not an option. I decided to investigate the issue.
NUnitASP is based on 1.x style NUnit. The use of the deprecated Assertion class instead of the Assert class makes this evident. NUnit has become stricter on the visibility of test fixture members. While test methods always have been required to be public, NUnit 1.x allowed the setup and teardown methods to be private. In NUnit 2.x these methods must be public as well.

To resolve the issue I downloaded the source code for NUnitASP and changed the visibility of the SetUp and TearDown methods in the WebFormTestCase class, built my own assembly and changed the reference in my test suite.
Doing this enables you to run tests in Test Driven .NET, however there are some issues that you still have to workaround.
The NUnitASP framework declares setup and teardown handlers in the WebFormTestCase class. These methods conflict with setup and teardown methods in your test fixture. This could be solved by making further changes to the WebFormTestCase class. However, I prefer to keep the changes to this class to a minimum so I suggest that you shadow the implementation of the BaseSetUp and BaseTearDown methods in your test fixture if you need a setup or teardown handler.

Here is an example of a shadowed setup handler:
[SetUp]
new public void BaseSetUp() {
            base.BaseSetUp();
            Browser.GetPage(home.ToString());
}