Monday, September 26, 2005

Test Driven Development in .NET - NUnit forms and NunitASP

Continuing the discussion further on Test Driven Development, I came across two tools just a month back. And yes they are NUnitforms and NunitASP.

NUnit is an indispensable tool. I use it as part of test driven development for all the applications i develop.But testing the the .aspx pages themselves is a problem. How can you test that the UI reacts to the user correctly? That the postback events happen in the right order? That the correct next page is loaded after the user completes the page? Testing these things requires that your code is running inside the ASP.NET worker process. Your pages need access to the HTTPContext, the Request and Response objects, everything else that ASP.NET provides them at runtime. If you attempt to test your compiled .aspx pages directly from the NUnit test runner, none of them will even load, let alone pass your tests.
Ref: Testing ASP.NET Applications with NUnitASP and NUnit. The server

NUnitAsp is a tool for automatically testing ASP.NET web pages. NUnitAsp is for unit testing ASP.NET code-behind only. It's meant for programmers, not QA teams, and it's not very good for QA-style acceptance tests. It only tests server-side logic. JavaScript and other client-side code is ignored. But if you're using ASP.NET, it's an essential part of your programmers' toolset.

NUnitAsp is just an assembly, it'll work with all .NET languages, so yes it will work with VB.NET.

Controls supported in version 1.5.1:



NUnitForms is an NUnit extension for unit and acceptance testing of Windows Forms applications. Support is already built in for Buttons, Labels, TabControls, and Context Menus, with many others coming soon. It is very easy to add support for additional types of controls.

NUnitForms also provides a Recorder application that will Record your interactions with a Windows Forms class and write a Unit Test for you that duplicates your actions. You can perform asserts during this process by right-clicking on your controls and selecting the property to assert.

Currently i am trying to use these tools and in my next blog entry, i would post some code to show as to how it works.

No comments:

Post a Comment