about
framework & approach
knowledge network
news & events
technology council
why join?

Thursday, June 29, 2006

NUnitAsp, ASP.NET 2.0 and Master Pages

I've been trying to use NUnitASP to write some test fixtures for http://www.oceg.org (registration process in particular), but for the life of me I couldn't get it to work. It just could not find any of my controls.

I thought maybe there was no support for ASP.Net 2.0 yet; the latest news I could find dated from Nov. 2005 and mentioned a future 2.0 release of NUnitASP with full .Net 2.0 support. Nothing after that.

I contacted Jim Shore (main developer of NUnitASP), and received the following email:

"Hi, Stephane,

The project isn't dead but it is significantly slowed down to my other commitments. You can get the latest code from CVS; that is pretty much what will be released as NUnitAsp 2.0 when the time finally comes."

Good to know! Well, I downloaded the latest version, and still no success. After digging a bit through the source, I realized there was no support for Master Pages. So here are 2 NUnitASP testers that will enable MasterPage and ContentPlaceHolder support:

http://http.oceg.org/public/MasterPageTester.zip

Both files go under NUnitAsp/AspTester. Use these classes in the same way you would drill down user controls in NUnitASP:

MasterPageTester masterPage =
new MasterPageTester(new WebFormTester(HttpClient.Default));

MasterPageContentTester contentPH
= new MasterPageContentTester("ContentPlaceHolder1", masterPage);

LinkButtonTester registerButton = new LinkButtonTester("SignUp_Registered_Button", contentPH);

2 comments:

John said...

The link for the ZIP file no longer works. Is archive available somewhere else?

Thanks!

Stephane Legay said...

Hey John, I looked for that file everywhere but couldn't find it. Sorry...

We don't use NUnit or NUnitAsp anymore, we've upgraded to Visual Studio Team System.