Does it ever happen to you that you go to work in the morning, look at the screen and then ask yourself : What the heck was I working on?? Happens to me all the time. Maybe I was in the middle of debugging some code the previous day, or writing a unit-test or finishing up the implementation of a class or going through existing code to understand what it’s doing or something else. Given the detailed nature of software development, it’s sometimes hard to remember where you left off and from where you need to pick things up again.
Below is an approach that’s worked quite well for me:
I write myself a little MS Outlook note and put right in the middle of the screen. Simple, but very effective!
When it comes to writing unit tests for your ASP .NET pages, there isn’t much help out there. I experimented with a few open source testing tools and found some major limitations.
Both NUnitAsp and WaitN, for instance, are “client-side” tools. In other words, you have to write your tests against the actual HTML output. For example, to get the value of a textbox, you have to specify the actual HTML id of the textbox. That’s painful! Especially, since ASP .NET ends up assigning long and complicated ID’s to your controls. Plus NUnitAsp is no longer being maintained or supported.
Unlike NUnitAsp and WaitN, VS Studio ASP .NET Unit testing let’s you examine the actual HttpRequest object. What this means is that you can call methods on your Page and get access to the controls within the page. VS Studio ASP .NET is a pretty decent tool and maybe the answer for you. IF you don’t need to use TypeMock that is. But if you do, then tough luck because VS Studio ASP .NET unit tests don’t work with TypeMock. If you give it try, you’ll get the following exception:
Test method AzAsh.WebApp.Tests.DefaultTest.LoginNotRequiredTest threw exception: TypeMock.TypeMockException: *** Typemock Isolator is not currently enabled. To enable do one of the following: * To run Typemock Isolator as part of an automated process you can: - run tests via TMockRunner.exe command line tool - use 'TypeMockStart' tasks for MSBuild or NAnt * To work with Typemock Isolator inside Visual Studio.NET: set Tools->Enable Typemock Isolator from within Visual Studio For more information consult the documentation (see 'Running' topic).
Check the enable property as they have suggested and you’ll notice that Typemock is enabled! So, what gives? I have no idea. But I do know that Ivonna – a ASP .NET testing tool that is being developed in partnership with TypeMock WILL let you work in conjunction with TypeMock. Like VS Studio, it allows you to examine the intrinsic objects, such as the Page object. In addition, it’s got another neat feature that let’s you inject setup code and assertions into your page’s lifecycle event handlers – very handy especially during type mocking. The only drawback is that it’s a little slow. The unit tests take a while to run.
So if you’ve been scratching your head trying to figure how to develop ASP .NET tests that can work with TypeMock, Ivonna is probably the tool you’ve been waiting for!